/* ===== NUT ACADEMY =====
 * Login y dashboards con la identidad NUT (ver marca/nut/DESIGN.md):
 * Nuez (#EEEEEE) sobre Núcleo (#000000), sin acentos de color.
 */
:root {
    color-scheme: dark;
    --bg: #000000;
    --surface: #111111;
    --surface-2: #1F1F1F;
    --fg: #EEEEEE;
    --fg-2: #A3A3A3;
    --muted: #8A8A8A;
    --border: #2A2A2A;
    --border-strong: #3A3A3A;
    --accent-on: #0A0A0A;
    --accent-gradient: linear-gradient(135deg, #FFFFFF 0%, #A3A3A3 100%);
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Share Tech Mono', ui-monospace, Menlo, monospace;
    --transition: all 0.18s ease;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}

a { color: var(--fg); }

:focus-visible {
    outline: 2px solid #FFFFFF;
    outline-offset: 3px;
}

/* ===== MARCA ===== */
.academy-tag {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fg-2);
}

/* ===== LOGIN ===== */
.academy-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(90% 70% at 50% 0%, #1F1F1F 0%, #000000 60%);
}

.login-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    padding: 44px 36px;
    width: 100%;
    max-width: 420px;
}

.login-container .logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-container .logo img {
    height: 96px;
    width: auto;
    display: block;
    margin: 0 auto 14px;
}

.login-container .logo p {
    color: var(--fg-2);
    font-size: 14px;
    margin-top: 6px;
}

.login-container .form-group {
    margin-bottom: 22px;
}

.login-container label {
    display: block;
    color: var(--fg);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.login-container input {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--fg);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
}

.login-container input::placeholder { color: var(--muted); }

.login-container input:focus {
    outline: none;
    border-color: var(--fg);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: var(--accent-gradient);
    color: var(--accent-on);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.12);
}

.btn-login:active { transform: translateY(0); }

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.footer-text {
    text-align: center;
    margin-top: 26px;
    color: var(--muted);
    font-size: 13px;
}

.footer-text a {
    color: var(--fg-2);
    text-decoration: none;
}

.footer-text a:hover { color: var(--fg); }

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent-on);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: -3px;
}

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

/* ===== ALERTAS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.alert.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

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

/* ===== NAVBAR ===== */
.navbar {
    background: rgba(0, 0, 0, 0.95);
    border-bottom: 1px solid var(--border);
    color: var(--fg);
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.navbar-brand img {
    height: 36px;
    width: auto;
    display: block;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--fg-2);
    font-size: 14px;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--fg);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--fg);
    color: var(--accent-on);
    border-color: var(--fg);
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.academy-admin .container { max-width: 1400px; }

h1, h2, h3, h4 { color: var(--fg); }

.welcome {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 30px;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.welcome h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.welcome p {
    color: var(--fg-2);
    font-size: 16px;
}

.section-title {
    margin-bottom: 20px;
    font-size: 22px;
}

/* ===== CURSOS (ALUMNO) ===== */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 2rem;
}

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

.course-card:hover {
    transform: translateY(-4px);
    border-color: var(--fg);
}

.course-header {
    background: linear-gradient(135deg, #1F1F1F 0%, #0A0A0A 100%);
    border-bottom: 1px solid var(--border);
    color: var(--fg);
    padding: 24px;
}

.course-header h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.course-header p {
    font-size: 14px;
    color: var(--fg-2);
}

.course-body { padding: 24px; }

.course-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.stat { flex: 1; }

.stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--fg);
}

.progress-bar {
    background: var(--surface-2);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    background: var(--accent-gradient);
    height: 100%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 13px;
    color: var(--fg-2);
    text-align: right;
}

/* ===== BOTONES ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--accent-gradient);
    color: var(--accent-on);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 255, 255, 0.12);
}

.btn-secondary {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--fg);
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--fg-2);
}

.btn-danger {
    background: #DC2626;
    color: #FFFFFF;
}

.btn-danger:hover { background: #B91C1C; }

.btn-success {
    background: var(--success);
    color: var(--accent-on);
}

.btn-success:hover { background: #34D399; }

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-download {
    background: var(--fg);
    color: var(--accent-on);
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
}

.btn-download:hover { background: #FFFFFF; }

/* ===== ARCHIVOS ===== */
.files-section {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 24px;
}

.files-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.file-item:hover { border-color: var(--border-strong); background: #262626; }

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.file-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-on);
    font-size: 20px;
}

.file-details { min-width: 0; }

.file-details h4 {
    font-size: 15px;
    margin-bottom: 4px;
}

.file-details p {
    font-size: 13px;
    color: var(--fg-2);
}

.file-actions {
    display: flex;
    gap: 8px;
}

.link-url {
    color: var(--fg-2);
    font-size: 0.9em;
    word-break: break-all;
    display: block;
    margin-top: 4px;
}

.link-url:hover { color: var(--fg); }

/* ===== ESTADOS VACÍOS Y BADGES ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.empty-state-icon {
    font-size: 60px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state svg {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state.error { color: #F87171; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.14); color: #34D399; }
.badge-warning { background: rgba(245, 158, 11, 0.14); color: #FBBF24; }
.badge-danger { background: rgba(239, 68, 68, 0.14); color: #F87171; }

/* ===== ADMIN: TABS, STATS, TARJETAS, TABLAS ===== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--fg-2);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}

.tab:hover { color: var(--fg); }

.tab.active {
    color: var(--fg);
    border-bottom-color: var(--fg);
}

.tab-content { display: none; }

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius-md);
}

.stat-card h3 {
    color: var(--fg-2);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--fg);
    font-variant-numeric: tabular-nums;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.card-header h2 { font-size: 20px; }

table {
    width: 100%;
    border-collapse: collapse;
}

thead { background: var(--surface-2); }

th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    color: var(--fg-2);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--fg);
}

tbody tr:hover { background: #161616; }

.action-buttons {
    display: flex;
    gap: 8px;
}

/* ===== MODALES ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show { display: flex; }

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.academy-alumno .modal-content { max-width: 800px; }

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 22px; }

.close-modal {
    float: right;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}

.close-modal:hover { color: var(--fg); }

/* Bloques de detalle generados por los dashboards */
.detail-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: var(--radius-sm);
}

.detail-block h4 {
    margin: 0 0 15px 0;
    color: var(--fg);
}

.detail-text {
    margin: 0;
    line-height: 1.6;
    color: var(--fg-2);
}

/* ===== FORMULARIOS (ADMIN) ===== */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--fg);
}

.form-group input,
.form-group select,
.form-group textarea,
.academy-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--fg);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.18s ease;
}

.academy-select { width: auto; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.academy-select:focus {
    outline: none;
    border-color: var(--fg);
}

select option {
    background: var(--surface);
    color: var(--fg);
}

select[multiple] {
    min-height: 120px !important;
    padding: 8px;
}

select[multiple] option {
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
}

select[multiple] option:checked {
    background: var(--fg) !important;
    color: var(--accent-on) !important;
}

.select-info,
.form-hint {
    font-size: 12px;
    color: var(--fg-2);
    margin-top: 4px;
}

.form-hint { display: block; margin-top: 0.5rem; }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .navbar { padding: 0.75rem 1rem; }
    .navbar-brand img { height: 28px; }
    .navbar-brand .academy-tag { display: none; }
    .navbar-user #userName { display: none; }
    .container { padding: 1.25rem 1rem; }
    .courses-grid { grid-template-columns: 1fr; }
    .file-item { flex-direction: column; align-items: stretch; }
    .file-actions { justify-content: flex-end; }
    .login-container { padding: 36px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
