/* VARIABLES GLOBALES */
:root {
    --bg-color: #0f172a;
    --panel-bg: #1e293b;
    --border-color: #334155;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;

    /* Configuración del documento PDF */
    --pdf-width: 794px;
    /* A4 en 96dpi */
    --pdf-height: 1123px;
    --pdf-bg: #e2d9cd;
    /* Color beige de la imagen original */
    --pdf-text-dark: #374151;
    --pdf-text-blue: #1e3a5f;
    --pdf-accent: #cc7852;
}

/* RESET GENERAL */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* LAYOUT PRINCIPAL */
.app-container {
    display: flex;
    height: 100vh;
}

/* PANEL LATERAL (Sidebar Formulario) */
.sidebar {
    width: 420px;
    background-color: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.sidebar-header h1 span {
    color: var(--accent-color);
    font-size: 0.8em;
    vertical-align: top;
}

.sidebar-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* FORMULARIOS */
.controls-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    resize: none;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.box-upload {
    background-color: rgba(59, 130, 246, 0.05);
    border: 1px dashed var(--border-color);
    padding: 0.8rem;
    border-radius: 6px;
}

.remove-check-label {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #ef4444;
    cursor: pointer;
    font-weight: 600;
}

.remove-check-label input {
    width: auto !important;
    margin-right: 0.4rem;
    display: inline-block !important;
}

.slider-container {
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
}

.slider-container label {
    display: block;
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
    text-transform: none;
    color: var(--text-secondary);
}

.slider-container input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.color-picker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.2rem;
}

.color-picker-row label {
    text-transform: none;
    margin: 0;
    font-size: 0.85rem;
}

.color-picker-row input[type="color"] {
    position: relative;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    background: none;
}

.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-row input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* BOTONES */
.primary-btn,
.secondary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: white;
    border: none;
    padding: 0.85rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.small-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
}

.icon-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--accent-hover);
}

.button-group-inline {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.select-container {
    display: flex;
    gap: 0.5rem;
}

.primary-btn {
    background-color: var(--accent-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.primary-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
}

.secondary-btn:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.05);
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-btn:active,
.secondary-btn:active:not(:disabled) {
    transform: translateY(0);
}

.hidden {
    display: none !important;
}

.msg-text {
    font-size: 0.85rem;
    text-align: center;
    margin-top: 0.5rem;
}

.msg-success {
    color: #10b981;
}

.msg-error {
    color: #ef4444;
}

/* ÁREA DE VISTA PREVIA */
.preview-area {
    flex: 1;
    background: repeating-linear-gradient(45deg,
            #0f172a,
            #0f172a 10px,
            #131b2e 10px,
            #131b2e 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    padding: 2rem;
}

.preview-wrapper {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.preview-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.preview-header .badge {
    background-color: #475569;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 1px;
}

/* DOCUMENTO A4 */
.canvas-wrapper {
    align-self: center;
    background: #000;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    transform-origin: top center;
    transform: scale(0.85);
    transition: transform 0.3s ease;
}

.pdf-document {
    width: var(--pdf-width);
    height: var(--pdf-height);
    background-color: var(--pdf-bg);
    position: relative;
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
    color: var(--pdf-text-dark);
}

/* Capas de imágenes */
.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.header-logo-layer {
    position: absolute;
    top: 40px;
    right: 40px;
    max-width: 250px;
    max-height: 100px;
    object-fit: contain;
    z-index: 5;
}

.footer-logo-layer {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 400px;
    max-height: 120px;
    object-fit: contain;
    z-index: 5;
}

/* CONTENIDO DINÁMICO DEL PDF */
.pdf-content {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    padding: 6rem 4rem;
    display: flex;
    flex-direction: column;
}

.header-section {
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 4rem;
}

.doc-room {
    font-size: 32px;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 3px;
    color: #434449;
    margin-bottom: 1rem;
}

.doc-acronym {
    font-size: 64px;
    font-weight: 800;
    color: var(--pdf-accent);
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    line-height: 1;
}

.doc-name {
    font-size: 22px;
    font-weight: 700;
    color: #4f5155;
    max-width: 80%;
    margin: 0 auto;
    line-height: 1.4;
}

/* CUERPO CENTRAL: Speakers y QR */
.body-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 3rem;
    padding: 0 1rem;
}

.speakers-column {
    flex: 1;
    padding-right: 4rem;
}

.speakers-title {
    font-size: 24px;
    font-weight: 800;
    color: #000;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.speakers-list {
    list-style: none;
    font-family: 'Inter', sans-serif;
}

.speakers-list li {
    font-size: 22px;
    font-weight: 600;
    color: var(--pdf-text-blue);
    margin-bottom: 0.8rem;
}

/* COLUMNA QR */
.qr-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 4rem;
}

.qr-title {
    font-size: 22px;
    font-weight: 800;
    color: #000;
    margin-bottom: 1rem;
}

.qr-box {
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* MEDIA QUERIES */
@media (max-width: 1300px) {
    .canvas-wrapper {
        transform: scale(0.7);
    }
}

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: 50vh;
    }

    .preview-area {
        height: 50vh;
    }

    .canvas-wrapper {
        transform: scale(0.5);
    }
}