/* style.css - v3.0 Modern Design */

:root {
    /* Paleta de colores minimalista */
    --primary-color: #2563eb; /* Azul moderno */
    --secondary-color: #64748b; /* Gris slate */
    --accent-color: #f59e0b; /* Ámbar */
    --success-color: #10b981; /* Verde esmeralda */
    --danger-color: #ef4444; /* Rojo coral */
    --warning-color: #f59e0b; /* Ámbar */

    /* Escala de grises */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Espaciado consistente (sistema de 8px) */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Bordes y sombras */
    --border-radius-sm: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transiciones */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Site Header */
.site-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-logo {
    max-height: 40px;
    width: auto;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.header-actions .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

body {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.main-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    background: var(--gray-50);
}

.form-section {
    flex: 1;
    min-height: 100vh;
    overflow-y: auto;
    padding: var(--spacing-2xl) var(--spacing-xl);
    background: white;
    border-right: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.preview-section {
    flex: 1;
    min-height: 100vh;
    overflow-y: auto;
    padding: var(--spacing-2xl) var(--spacing-xl);
    background: var(--gray-50);
    position: relative;
}

#preview-pane {
    background: white;
    padding: var(--spacing-2xl) var(--spacing-2xl);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-xl);
    min-height: 95%;
    font-size: 14px;
    color: var(--gray-800);
    transition: var(--transition-normal);
    border-radius: var(--border-radius-lg);
    position: relative;
    overflow: hidden;
}

#preview-pane::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

#preview-logo {
    max-width: 160px;
    max-height: 70px;
    object-fit: contain;
}

.service-item {
    border: 1px solid var(--gray-200);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--spacing-lg);
    position: relative;
    background: white;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.service-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.service-item-template {
    display: none;
}

.remove-service-btn {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--danger-color);
    opacity: 0.8;
    transition: var(--transition-fast);
    cursor: pointer;
}

.remove-service-btn:hover {
    opacity: 1;
    background: var(--danger-color);
    color: white;
    transform: scale(1.05);
}

.form-section h2 {
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 3px solid var(--primary-color);
    color: var(--gray-900);
    letter-spacing: -0.025em;
}

#preview-pane h1, #preview-pane h2, #preview-pane h3 {
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.025em;
}

#preview-pane h1 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-lg);
}

.preview-header {
    border-bottom: 2px solid #0d6efd;
    padding-bottom: 20px;
}

.preview-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #666;
}

.total-section {
    text-align: right;
    margin-top: 30px;
}

.total-section h3 {
    font-size: 1.5rem;
}

.form-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 20px 0;
    border-top: 1px solid #eee;
    z-index: 1000; /* Ensure it's above other content */
}

.theme-switcher {
    position: sticky;
    bottom: 0;
    background-color: #f4f7f9;
    padding: 10px 0;
    text-align: center;
    z-index: 1000; /* Ensure it's above other content */
}

.service-details {
    font-size: 0.85em;
    color: #666;
    padding: 5px 10px;
    background-color: #f8f9fa;
    border-top: 1px solid #eee;
}

/* --- JERARQUÍA SERVICIOS Y ENTREGABLES --- */

.deliverable-row {
    background-color: var(--gray-50) !important;
}

.deliverable-row td {
    border-top: none !important;
    padding-top: var(--spacing-xs) !important;
    padding-bottom: var(--spacing-xs) !important;
}

.service-section {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    background-color: white;
    box-shadow: var(--shadow-sm);
}

.deliverable-item-minimal {
    border-left: 3px solid var(--primary-color);
    padding-left: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background-color: var(--gray-50);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-sm) var(--spacing-md);
}

/* Animaciones smooth */
.service-item, .deliverable-item {
    transition: var(--transition-normal);
}

.service-item:hover, .deliverable-item:hover {
    box-shadow: var(--shadow-md);
}

.deliverable-item {
    animation: slideIn var(--transition-normal);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Indicadores visuales de jerarquía */
.deliverables-container {
    border-left: 2px solid var(--gray-200);
    padding-left: var(--spacing-md);
    margin-left: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.deliverable-item {
    position: relative;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.deliverable-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.deliverable-item::before {
    content: '';
    position: absolute;
    left: -12px;
    top: var(--spacing-lg);
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--gray-200);
}

/* Validación en tiempo real */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

.invalid-feedback {
    display: none;
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 0.25rem;
}

.form-control.is-invalid + .invalid-feedback {
    display: block;
}

/* Form specific styles */
.form-control, .form-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.95rem;
    transition: var(--transition-fast);
    background: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-control:hover, .form-select:hover {
    border-color: var(--gray-300);
}

.btn {
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: #1d4ed8;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border: 2px solid var(--gray-300);
    color: var(--gray-600);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

/* --- THEME STYLES --- */

/* Theme 1: Profesional (Default) */
.theme-professional .preview-header { border-color: var(--primary-color); }
.theme-professional thead { background-color: var(--primary-color) !important; color: white; }

/* Theme 2: Creativo */
.theme-creative {
    font-family: 'Georgia', serif;
}
.theme-creative .preview-header { border-color: var(--accent-color); }
.theme-creative thead { background-color: var(--accent-color) !important; color: white; }
.theme-creative h1, .theme-creative h5 { font-weight: bold; }

/* Theme 3: Minimalista */
.theme-minimalist {
    font-family: 'Courier New', monospace;
    border-width: 1px;
    box-shadow: none;
}
.theme-minimalist .preview-header { border-bottom: 1px solid var(--gray-900); }
.theme-minimalist table { border: 1px solid var(--gray-200); }
.theme-minimalist thead { background-color: var(--gray-100) !important; color: var(--gray-900); border-bottom: 1px solid var(--gray-300); }
.theme-minimalist .table-striped>tbody>tr:nth-of-type(odd)>* { background-color: transparent; }

/* Theme 4: Moderno (Dark) */
.theme-modern {
    background-color: var(--gray-900) !important;
    color: var(--gray-100) !important;
    border-color: var(--gray-700);
    padding: 20px;
    border-radius: 8px;
}
.theme-modern .preview-header { border-color: #08f; }
.theme-modern h5 { color: var(--gray-400); }
.theme-modern strong { color: white; }
.theme-modern .table { color: var(--gray-100); }
.theme-modern thead { background-color: #08f !important; color: white; }
.theme-modern .table-striped>tbody>tr:nth-of-type(odd)>* { background-color: rgba(255, 255, 255, 0.05); }
.theme-modern .preview-footer { border-top-color: var(--gray-700); color: var(--gray-400); }
.theme-modern .preview-footer h5 { color: var(--gray-100) !important; }
.theme-modern .preview-footer .terms-title { color: var(--gray-100) !important; }
.theme-modern p { color: var(--gray-100) !important; }
.theme-modern td { color: var(--gray-100) !important; }
.theme-modern h1, .theme-modern h2, .theme-modern h3, .theme-modern h4, .theme-modern h6 { color: var(--gray-100) !important; }
.theme-modern span { color: var(--gray-100) !important; }
.theme-modern div { color: var(--gray-100) !important; }

/* --- STEP INDICATOR --- */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-lg);
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    opacity: 0.5;
    transition: var(--transition-normal);
}

.step-item.active {
    opacity: 1;
}

.step-item.completed {
    opacity: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.step-item.active .step-number {
    background: var(--primary-color);
    color: white;
}

.step-item.completed .step-number {
    background: var(--success-color);
    color: white;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    text-align: center;
    white-space: nowrap;
}

.step-item.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.step-connector {
    width: 60px;
    height: 2px;
    background: var(--gray-200);
    margin: 0 var(--spacing-sm);
    transition: var(--transition-fast);
}

.step-item.completed + .step-connector {
    background: var(--success-color);
}

/* --- FORM STEPS --- */
.form-step {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.form-step.active {
    display: block;
}

.step-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--primary-color);
}

.step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--gray-200);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- RESPONSIVE DESIGN (Mobile-first) --- */

/* Mobile */
@media (max-width: 768px) {
    /* Header responsive */
    .site-header {
        position: relative; /* Not sticky on mobile */
    }

    .site-title {
        font-size: 1.25rem;
    }

    .header-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-actions .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Form section comes after header on mobile */
    .main-container {
        flex-direction: column;
        min-height: auto;
    }

    .form-section,
    .preview-section {
        flex: none;
        width: 100%;
        min-height: auto;
        padding: var(--spacing-lg);
        border-right: none;
    }

    .preview-section {
        padding-top: var(--spacing-xl);
    }

    #preview-pane {
        min-height: auto;
        padding: var(--spacing-lg);
        margin: 0 -var(--spacing-lg);
    }

    .form-section h2 {
        font-size: 1.75rem;
        margin-bottom: var(--spacing-lg);
    }

    .service-item {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }

    .form-actions {
        position: relative;
        padding: var(--spacing-md) 0;
        margin-top: var(--spacing-lg);
    }

    .total-section .col-4 {
        width: 100%;
        margin-top: var(--spacing-md);
    }

    .deliverables-container {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
    }

    .deliverable-item::before {
        display: none;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .form-section,
    .preview-section {
        padding: var(--spacing-xl);
    }

    #preview-pane {
        padding: var(--spacing-xl);
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .form-section {
        max-width: 50%;
    }

    .preview-section {
        max-width: 50%;
    }
}

/* Regular Footer (not fixed) */
.fixed-footer {
    position: relative;
    background: white;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
}

/* Remove margin from main container since footer is not fixed */
.main-container {
    margin-bottom: 0;
}
