/* ===== VARIABLES CERTUAP UNIFICADAS ===== */
:root {
    /* Colores CertUAP oficiales */
    --color-primary: #0E2954;
    --color-secondary: #1A5F7A;
    --color-accent: #57C5B6;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-orange: #ff6b35;
    --navbar-dark: #151a22;
    --navbar-secondary: #2c3e50;
    
    /* Superficie y fondos */
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    
    /* Sombras elegantes */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

/* ===== RESET BÁSICO ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--text-primary);
    padding-top: 70px;
    line-height: 1.6;
}

/* ===== NAVBAR CERTUAP ===== */
.navbar {
    background: linear-gradient(135deg, var(--navbar-dark) 0%, var(--navbar-secondary) 100%);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.navbar-brand img {
    height: 45px;
    transition: transform 0.3s ease;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-auth {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-auth:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-2px);
}

.btn-plans {
    background: linear-gradient(135deg, var(--color-warning) 0%, #fbbf24 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-plans:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 15px;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #ef4444;
    color: white;
}

/* ===== HERO SECTION CERTUAP ===== */
.hero-section {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== DASHBOARD CARDS ===== */
.dashboard-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.credits-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--surface-2) 0%, #f1f5f9 100%);
    padding: 1.5rem;
    border-radius: 16px;
    border: 2px solid var(--border);
    margin-bottom: 2rem;
}

.credits-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.credits-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--color-accent) 0%, #4db8a8 100%);
    color: white;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow);
}

.credits-text h4 {
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
}

.credits-count {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.credits-status.exhausted {
    border-color: var(--color-danger);
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.credits-status.exhausted .credits-icon {
    background: linear-gradient(135deg, var(--color-danger) 0%, #f87171 100%);
}

.credits-status.low {
    border-color: var(--color-warning);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.credits-status.guest {
    border-color: var(--color-accent);
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.credits-status.guest .credits-icon {
    background: linear-gradient(135deg, var(--color-accent) 0%, #16a34a 100%);
}

/* ===== BADGES DE PLAN ===== */
.plan-badge {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-badge.guest {
    background: linear-gradient(135deg, var(--color-accent) 0%, #16a34a 100%);
}

.plan-badge.pro {
    background: linear-gradient(135deg, var(--color-success) 0%, #16a34a 100%);
}

.plan-badge.enterprise {
    background: linear-gradient(135deg, var(--color-orange) 0%, #ea580c 100%);
}

/* ===== FORMULARIO GENERADOR ===== */
.generator-form {
    background: var(--surface);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.generator-form:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-control, .form-select {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 1rem;
    background: var(--surface);
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(87, 197, 182, 0.1);
    outline: none;
}

/* ===== BOTONES ===== */
.btn-generate {
    background: linear-gradient(135deg, var(--color-accent) 0%, #4db8a8 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.btn-generate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

.btn-generate:hover::before {
    left: 100%;
}

.btn-generate:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #009688 0%, var(--color-accent) 100%);
}

.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-upgrade {
    background: linear-gradient(135deg, var(--color-orange) 0%, #ff8a65 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 1rem 2rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-upgrade:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #ff5722 0%, var(--color-orange) 100%);
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: var(--surface);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== SECCIÓN DE RESULTADOS ===== */
.result-section {
    background: var(--surface);
    border-radius: 20px;
    padding: 3rem;
    margin: 3rem 0;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: none;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exam-header {
    background: linear-gradient(135deg, var(--surface-2) 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.exam-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    text-align: center;
}

.stat-item h5 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: var(--color-accent);
}

.stat-item small {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== PREGUNTAS ===== */
.question-item {
    background: var(--surface-2);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--color-accent);
    transition: all 0.3s ease;
}

.question-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.question-number {
    background: var(--color-accent);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.question-text {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.options-list {
    list-style: none;
    padding: 0;
}

.option-item {
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.option-item:hover {
    border-color: var(--color-accent);
    background: rgba(87, 197, 182, 0.05);
}

.option-item.correct {
    border-color: var(--color-success);
    background: rgba(40, 167, 69, 0.1);
}

/* ===== ALERTAS ===== */
.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.alert-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
}

.alert-warning::before {
    background: var(--color-warning);
}

.alert-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
}

.alert-danger::before {
    background: var(--color-danger);
}

.alert-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534;
}

.alert-success::before {
    background: var(--color-success);
}

/* ===== MODALES ===== */
.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    border-radius: 20px 20px 0 0;
    padding: 2rem;
    border: none;
    position: relative;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></svg>');
    opacity: 0.3;
}

.modal-title {
    position: relative;
    z-index: 2;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    border: none;
    padding: 1rem 2rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-modal-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-modal-primary:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-modal-success {
    background: linear-gradient(135deg, var(--color-accent) 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-modal-success:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===== RESPONSIVE CORREGIDO ===== */

/* Tablets (768px) */
@media (max-width: 768px) {
    body {
        padding-top: 55px !important;
    }
    
    .navbar {
        padding: 5px 0 !important;
        min-height: 50px !important;
    }
    
    .navbar .container {
        padding: 8px 15px !important;
        gap: 8px !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .navbar-brand img {
        height: 35px !important;
    }
    
    .header-actions {
        gap: 5px !important;
        flex-wrap: nowrap !important;
    }
    
    .auth-buttons {
        gap: 3px !important;
    }
    
    .btn-auth {
        font-size: 0.7rem !important;
        padding: 4px 8px !important;
        border-radius: 12px !important;
    }
    
    .hero-section {
        padding: 1.5rem 0 !important;
        margin-bottom: 1.5rem !important;
        margin-top: 0 !important;
    }
    
    .hero-content {
        padding: 0 1rem !important;
    }
    
    .hero-title {
        font-size: 1.8rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-subtitle {
        font-size: 0.9rem !important;
    }
    
    .generator-form {
        padding: 2rem;
        margin: 1rem;
    }
    
    .result-section {
        padding: 2rem;
        margin: 1rem;
    }
    
    .credits-status {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .exam-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .question-item {
        padding: 1.5rem;
    }
    
    .btn-generate,
    .btn-upgrade {
        width: 100%;
        margin: 1rem auto;
    }
}

/* Móviles (480px) */
@media (max-width: 480px) {
    body {
        padding-top: 50px !important;
    }
    
    .navbar {
        min-height: 45px !important;
        padding: 3px 0 !important;
    }
    
    .navbar .container {
        padding: 5px 10px !important;
        gap: 5px !important;
        flex-direction: column !important;
    }
    
    .navbar-brand img {
        height: 28px !important;
    }
    
    .header-actions {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .auth-buttons {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .btn-auth {
        font-size: 0.65rem !important;
        padding: 3px 6px !important;
    }
    
    .hero-section {
        padding: 1rem 0 !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-title {
        font-size: 1.4rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.8rem !important;
    }
    
    .generator-form,
    .result-section,
    .dashboard-card {
        padding: 1.5rem;
        margin: 0.75rem;
    }
    
    .credits-status {
        padding: 1rem;
    }
    
    .credits-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .exam-stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .question-item {
        padding: 1rem;
    }
    
    .modal-content {
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-modal-primary,
    .btn-modal-success {
        width: 100%;
    }
}

/* Móviles pequeños (360px) */
@media (max-width: 360px) {
    body {
        padding-top: 45px !important;
    }
    
    .navbar {
        min-height: 40px !important;
        padding: 2px 0 !important;
    }
    
    .navbar-brand img {
        height: 24px !important;
    }
    
    .hero-title {
        font-size: 1.2rem !important;
    }
    
    .generator-form,
    .result-section {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .credits-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* ===== LANDSCAPE MÓVIL ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        padding: 1rem 0 !important;
    }
    
    .navbar .container {
        flex-direction: row !important;
        justify-content: space-between !important;
    }
    
    .header-actions {
        width: auto !important;
        flex-direction: row !important;
    }
}

/* ===== ACCESIBILIDAD MÓVIL ===== */
@media (max-width: 480px) {
    .btn-auth,
    .btn-generate,
    .btn-upgrade {
        min-height: 44px;
        min-width: 44px;
    }
    
    input[type="text"],
    input[type="email"],
    textarea,
    select {
        font-size: 16px;
    }
    
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
}

/* ===== UTILIDADES ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.text-center { text-align: center; }
.d-flex { display: flex; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1.5rem; }

/* ===== SCROLLBAR PERSONALIZADA ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--surface-2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--color-accent) 0%, #4db8a8 100%);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #009688 0%, var(--color-accent) 100%);
}