/* === VARIABLES === */
:root {
    --verde: #27AE60;
    --verde-oscuro: #1E8449;
    --naranja: #F39C12;
    --azul-oscuro: #1F3A68;
    --azul-medio: #2980B9;
    --rojo: #C0392B;
    --gris-claro: #ECF0F1;
    --gris-medio: #7F8C8D;
    --gris-oscuro: #34495E;
    --beige-claro: #FAF3E0;
    --radio-sm: 6px;
    --radio-md: 8px;
}

/* === BASE === */
* { box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; color: #2C3E50; background: #f0f2f5; margin: 0; }
a { color: var(--verde); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
main { padding: 24px 0 64px; }

/* === HEADER === */
.prof-header { background: var(--verde); color: white; padding: 16px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.prof-header .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.prof-logo { color: white; font-weight: 800; font-size: 1.1rem; }
.prof-logo small { background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; margin-left: 8px; }
.prof-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.prof-nav a { color: rgba(255,255,255,0.85); padding: 8px 14px; border-radius: 6px; font-size: 0.9rem; font-weight: 600; }
.prof-nav a:hover { background: rgba(255,255,255,0.15); color: white; text-decoration: none; }
.prof-nav a.active { background: white; color: var(--verde); }
.prof-nav a.logout { color: var(--naranja) !important; background: rgba(0,0,0,0.2); }

/* === CARDS / BOTONES / FORMULARIOS === */
.card { background: white; padding: 24px; border-radius: var(--radio-md); box-shadow: 0 2px 6px rgba(0,0,0,0.06); margin-bottom: 24px; }
.btn { display: inline-block; padding: 10px 20px; border: none; border-radius: var(--radio-sm); font-weight: 600; font-size: 0.95rem; cursor: pointer; text-decoration: none; transition: all 0.2s; }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--verde); color: white; }
.btn-primary:hover { background: var(--verde-oscuro); color: white; }
.btn-secondary { background: var(--azul-medio); color: white; }
.btn-ghost { background: transparent; color: var(--gris-oscuro); border: 1px solid var(--gris-claro); }
.btn-ghost:hover { background: var(--gris-claro); }
.btn-danger { background: var(--rojo); color: white; }
.btn-success { background: var(--verde); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-control { width: 100%; padding: 10px 12px; border: 2px solid var(--gris-claro); border-radius: var(--radio-sm); font-size: 0.95rem; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--verde); }
.help { font-size: 0.8rem; color: var(--gris-medio); margin-top: 4px; }

.flash { padding: 12px 18px; border-radius: var(--radio-sm); margin-bottom: 16px; font-weight: 500; border-left: 4px solid; }
.flash-exito { background: #d4edda; color: #155724; border-left-color: var(--verde); }
.flash-error { background: #f8d7da; color: #721c24; border-left-color: #C0392B; }

/* === DASHBOARD STATS === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; padding: 20px; border-radius: var(--radio-md); border-left: 4px solid var(--naranja); box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.stat-label { font-size: 0.75rem; color: var(--gris-medio); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.stat-value { font-size: 2.4rem; font-weight: 800; color: var(--gris-oscuro); margin: 8px 0; line-height: 1; }

/* === DATA TABLE === */
.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: var(--radio-md); overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--gris-claro); font-size: 0.9rem; }
.data-table th { background: var(--verde); color: white; font-weight: 700; text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.5px; }
.data-table tr:hover { background: #f8f9fa; }
.data-table code { background: var(--beige-claro); padding: 2px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; }

.tag { display: inline-block; padding: 4px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 700; background: var(--beige-claro); color: var(--gris-oscuro); }
.tag.gris { background: var(--gris-claro); color: var(--gris-oscuro); }
.tag.azul { background: #dbeafe; color: var(--azul-oscuro); }
.badge-estado { display: inline-block; padding: 4px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 700; }
.badge-pendiente { background: #fff3cd; color: #856404; }
.badge-activo { background: #d4edda; color: #155724; }
.badge-inactivo { background: #e2e3e5; color: #6c757d; }
.badge-rechazado { background: #f8d7da; color: #721c24; }

.admin-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; padding: 16px; background: white; border-radius: var(--radio-md); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .prof-header .container { flex-direction: column; align-items: stretch; }
    .prof-nav { justify-content: center; }
    .container { padding: 0 16px; }
    .stat-value { font-size: 1.8rem; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 8px 10px; }
}

/* === INPUTS DE CALIFICACIONES (mejorados 2026-08-08) === */
.badge-matricula {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    background: #FAF3E0;
    color: #7D6608;
    border: 1px solid #F9E79F;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    vertical-align: middle;
    white-space: nowrap;
}
.nota-input {
    width: 78px !important;
    padding: 10px 8px !important;
    text-align: center;
    font-weight: 800;
    font-size: 1.15rem;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    border: 2px solid var(--gris-claro);
    border-radius: 6px;
    background: white;
    color: #1a1a1a;
    -moz-appearance: textfield;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
    transition: all 0.15s ease;
}
.nota-input::-webkit-outer-spin-button,
.nota-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.nota-input:hover { border-color: var(--gris-medio); }
.nota-input:focus {
    border-color: var(--verde);
    background: #f0fff4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(39,174,96,0.18);
}
/* Colores distintos por tipo de input */
.nota-input.input-pct   { color: #1F3A68; border-color: #B0C4DE; background: #F0F6FC; }
.nota-input.input-pct:focus { border-color: #1F3A68; background: #E3F0FA; box-shadow: 0 0 0 3px rgba(31,58,104,0.18); }
.nota-input.input-prac  { color: #0E6655; border-color: #A3E4D7; background: #E8F8F5; }
.nota-input.input-prac:focus { border-color: #0E6655; background: #D5F5E3; box-shadow: 0 0 0 3px rgba(14,102,85,0.18); }
.nota-input.input-extra { color: #7D6608; border-color: #F9E79F; background: #FEF9E7; }
.nota-input.input-extra:focus { border-color: #7D6608; background: #FCF3CF; box-shadow: 0 0 0 3px rgba(125,102,8,0.18); }

table.data-table input.form-control {
    display: inline-block;
    width: auto;
    min-width: 78px;
}
table.data-table .data-table-actions { white-space: nowrap; }
table.data-table td.cell-num {
    text-align: center;
    vertical-align: middle;
    min-width: 90px;
}
table.data-table th.cell-num {
    text-align: center;
    font-size: 0.78rem;
}
.valor-display {
    display: block;
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--gris-medio);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}
.btn.btn-guardar { min-width: 96px; }

/* === FILTRO DE BUSQUEDA EN TABLAS === */
.table-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #FAF3E0 0%, #FEF9E7 100%);
    border: 1px solid #F9E79F;
    border-radius: 8px;
}
.table-filter-wrapper .filter-icon {
    font-size: 1.1rem;
    color: #7D6608;
}
.table-filter-input {
    flex: 1;
    min-width: 220px;
    padding: 9px 14px;
    border: 2px solid #F9E79F;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
    color: #2C3E50;
    transition: all 0.15s ease;
}
.table-filter-input::placeholder { color: #B7950B; }
.table-filter-input:focus {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.15);
    background: #FFFFFE;
}
.table-filter-input:hover { border-color: #D4AC0D; }
.btn-filter-clear {
    background: #7F8C8D;
    color: white;
    border: none;
    padding: 9px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s ease;
}
.btn-filter-clear:hover { background: #5D6D7E; }
.filter-counter {
    font-size: 0.85rem;
    color: #7D6608;
    font-weight: 600;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

/* === MODAL DE CONFIRMACION === */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.confirm-overlay.confirm-visible { opacity: 1; }
.confirm-overlay.confirm-leaving { opacity: 0; }
.confirm-modal {
    background: white;
    border-radius: 12px;
    padding: 28px 32px 24px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    text-align: center;
    transform: scale(0.92) translateY(8px);
    transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.confirm-overlay.confirm-visible .confirm-modal { transform: scale(1) translateY(0); }
.confirm-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 12px;
}
.confirm-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1F3A68;
    margin: 0 0 8px;
}
.confirm-msg {
    color: #4A5568;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 24px;
}
.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.confirm-actions .btn { min-width: 130px; padding: 12px 20px; }
.btn-confirm-danger {
    background: var(--rojo);
    color: white;
}
.btn-confirm-danger:hover { background: #A93226; color: white; }
.btn-confirm-warning {
    background: var(--naranja);
    color: white;
}
.btn-confirm-warning:hover { background: #D68910; color: white; }
.btn-confirm-info {
    background: var(--azul-medio);
    color: white;
}
.btn-confirm-info:hover { background: #1F618D; color: white; }
.btn-ghost { background: transparent; color: var(--gris-oscuro); border: 2px solid var(--gris-claro); }
.btn-ghost:hover { background: var(--gris-claro); }

/* === TOOLBAR DE EXPORTACIÓN === */
.calif-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.calif-toolbar a {
    text-decoration: none;
    transition: all 0.15s ease;
}
.calif-toolbar a:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* === PRINT STYLES === */
@media print {
    .prof-header,
    .prof-nav,
    .calif-toolbar,
    .flash,
    form[method="post"],
    .btn { display: none !important; }
    .container { max-width: 100% !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
    body { background: white !important; }
    main { padding: 0 !important; }
    .data-table { font-size: 0.75rem; box-shadow: none !important; }
    .data-table th { background: #1F3A68 !important; color: white !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .data-table tr { page-break-inside: avoid; }
    .data-table thead { display: table-header-group; }
    .nota-input { border: 1px solid #999 !important; background: white !important; color: black !important; -webkit-print-color-adjust: exact; }
    h1, h2 { color: black !important; }
}

