/* ============================================
   REVISIÓN DE CUADERNOS - HRC
   Diseño Responsive, Minimalista y Elegante
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #0f172a;
    --accent: #10b981;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   UTILIDADES
   ============================================ */

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

.pantalla {
    display: none;
    min-height: 100vh;
}

.pantalla.activa {
    display: flex;
    flex-direction: column;
}

/* ============================================
   LOGO
   ============================================ */

.logo-wrapper {
    width: 96px;
    height: 96px;
    margin: 0 auto 24px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--bg-card);
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInDown 0.6s ease;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid var(--border);
}

/* ============================================
   PANTALLA DE BÚSQUEDA
   ============================================ */

#pantalla-busqueda {
    justify-content: center;
    align-items: center;
    padding: 40px 16px;
}

.logo-area {
    text-align: center;
    margin-bottom: 64px;
}

.logo-icon i {
    font-size: 36px;
    color: white;
}

.logo-area h1 {
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    font-weight: 00;
    color: #888f92;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 400;
}

.search-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    animation: fadeInUp 0.6s ease 0.1s both;
    text-align: center;
    box-sizing: border-box;
}

.search-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.search-icon i {
    font-size: 24px;
    color: var(--primary);
}

.search-card label {
    display: block;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 16px;
}

.input-group {
    display: flex;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

#dni-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-align: center;
    color: var(--text);
    transition: var(--transition);
    outline: none;
    font-family: 'Inter', monospace;
    box-sizing: border-box;
}

#dni-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

#dni-input::placeholder {
    color: var(--text-light);
    letter-spacing: normal;
}

#btn-buscar {
    flex: 0 0 auto;
    padding: 14px 22px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-sizing: border-box;
}

#btn-buscar:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgb(37 99 235 / 0.4);
}

#btn-buscar:active {
    transform: translateY(0);
}

.hint {
    color: var(--text-light);
    font-size: 0.85rem;
}

.mensaje-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    color: #dc2626;
    font-size: 0.9rem;
    display: none;
    animation: shake 0.4s ease;
}

.mensaje-error.visible {
    display: block;
}

.footer-info {
    text-align: center;
    margin-top: 32px;
    color: var(--text-light);
    font-size: 0.7rem;
    animation: fadeIn 0.6s ease 0.2s both;
}

.footer-info i {
    color: var(--accent);
    margin-right: 6px;
}

/* ============================================
   HEADER
   ============================================ */

.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.95);
}

.header-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: var(--secondary);
    font-size: 1.1rem;
}

.header-brand i {
    color: var(--primary);
    font-size: 1.3rem;
}

.btn-nueva-busqueda {
    padding: 10px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-nueva-busqueda:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    padding: 32px 0;
    animation: fadeIn 0.4s ease;
}

/* ============================================
   TARJETA ESTUDIANTE
   ============================================ */

.estudiante-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.estudiante-avatar {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-light), #bfdbfe);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.estudiante-avatar i {
    font-size: 28px;
    color: var(--primary);
}

.estudiante-info h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.estudiante-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.estudiante-meta span {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.estudiante-meta i {
    color: var(--primary);
    font-size: 0.85rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary);
    border-radius: 2px;
}

/* ============================================
   GRID DE BIMESTRES
   ============================================ */

.bimestres-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 20px;
}

.bimestre-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.bimestre-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.bimestre-card.disponible {
    border-color: var(--primary);
}

.bimestre-card.no-disponible {
    opacity: 0.6;
    cursor: not-allowed;
}

.bimestre-card.no-disponible:hover {
    transform: none;
    box-shadow: var(--shadow);
}

.bimestre-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary-light), #eff6ff);
    text-align: center;
}

.bimestre-header i {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 8px;
}

.bimestre-header h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0;
}

.bimestre-body {
    padding: 16px;
    text-align: center;
}

.bimestre-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.status-ok {
    background: #d1fae5;
    color: #059669;
}

.status-pending {
    background: #f1f5f9;
    color: var(--text-light);
}

.bimestre-fecha {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.bimestre-consultas {
    font-size: 0.75rem;
    color: #dc2626;  /* ← Rojo */
    font-weight: 600;
}

.bimestre-btn {
    margin-top: 16px;
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.bimestre-btn:hover {
    background: var(--primary-dark);
}

.bimestre-card.no-disponible .bimestre-btn {
    background: var(--border);
    color: var(--text-light);
    cursor: not-allowed;
}

/* ============================================
   MODAL VISOR
   ============================================ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.modal.activo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 95%;
    max-width: 1100px;
    height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

.modal-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text);
}

.modal-title i {
    color: var(--primary);
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-tool {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-tool:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-tool.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-tool.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-tool.btn-close {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
    margin-left: 4px;
}

.btn-tool.btn-close:hover {
    background: #dc2626;
    color: white;
}

.zoom-level {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 48px;
    text-align: center;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

.modal-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f1f5f9;
    cursor: grab;
}

.modal-body:active {
    cursor: grabbing;
}

.modal-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease;
    user-select: none;
}

/* ============================================
   LOADING
   ============================================ */

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 2000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.loading-overlay.activo {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay p {
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }
    
    .logo-area h1 {
        font-size: 1.5rem;
    }
    
    .search-card {
        padding: 28px 20px;
        margin: 0;
        max-width: 100%;
    }
    
    .input-group {
        flex-direction: column;
        gap: 12px;
    }
    
    #dni-input {
        width: 100%;
        font-size: 1rem;
        padding: 14px;
    }
    
    #btn-buscar {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }

    .header-content {
        padding: 12px 16px;
    }
    
    .header-brand span {
        display: none;
    }
    
    .estudiante-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .estudiante-meta {
        justify-content: center;
    }
    
    .bimestres-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-toolbar {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .modal-title {
        font-size: 0.9rem;
    }
    
    .zoom-level {
        display: none;
    }
    
    .divider {
        display: none;
    }
}

@media (max-width: 400px) {
    .modal-actions {
        gap: 4px;
    }
    
    .btn-tool {
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}