:root {
    --primary: #1e88e5;
    --primary-dark: #0d47a1;
    --primary-light: #1565c0;
    --secondary: #0a192f;
    --accent: #2196f3;
    --danger: #ef5350;
    --bg-body: #0a0e17;
    --bg-card: #111827;
    --bg-input: #1f293d;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #1e293b;
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

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

.animated-view {
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.clickable-animated {
    transition: all 0.25s ease;
    cursor: pointer;
}

.clickable-animated:active {
    transform: scale(0.97);
}

/* --- LOGIN --- */
#login-view {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, #0d1b2a 0%, #050811 100%);
    padding: 20px;
}

.login-card {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 40px 35px;
    border-radius: 18px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    width: 100%;
    max-width: 440px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.login-logo {
    width: 110px;
    height: auto;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 10px rgba(30, 136, 229, 0.3));
}

.login-card h2 {
    margin-bottom: 4px;
    color: var(--primary);
    font-size: 22px;
    font-weight: 700;
}

.login-card p.subtitle {
    color: var(--text-muted);
    font-size: 13.5px;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 18px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-main);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background-color: var(--bg-input);
    color: var(--text-main);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #172033;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.25);
}

.btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(13, 71, 161, 0.4);
}

.btn-guest {
    background: #334155;
    box-shadow: none;
    color: var(--text-main);
}

/* --- DASHBOARD --- */
#dashboard-view {
    display: none;
}

.top-bar {
    background: #0d1527;
    border-bottom: 1px solid var(--border-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-logo {
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 50%;
    padding: 2px;
    object-fit: cover;
}

.brand-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    background: var(--danger);
    color: white;
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.main-layout {
    display: flex;
    min-height: calc(100vh - 64px);
    position: relative;
}

.sidebar {
    width: 240px;
    background: #0d1322;
    border-right: 1px solid var(--border-color);
    padding-top: 20px;
}

.sidebar ul {
    list-style: none;
}

.sidebar li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sidebar li.active a, .sidebar li a:hover {
    background: rgba(30, 136, 229, 0.15);
    color: var(--primary);
    border-left: 4px solid var(--primary);
    padding-left: 26px;
}

.content-area {
    flex: 1;
    padding: 30px;
}

.banner-carousel {
    background: linear-gradient(135deg, #0d254c 0%, #091730 100%);
    border: 1px solid #1e3a66;
    color: var(--text-main);
    padding: 28px;
    border-radius: 14px;
    margin-bottom: 30px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

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

.section-title {
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
}

.badge-curso {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

/* GRID CURSOS */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
    margin-bottom: 35px;
}

.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, border-color 0.2s;
}

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

.card-header {
    height: 100px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    padding: 15px;
    text-align: center;
    background: linear-gradient(135deg, #0d2b5c 0%, #1565c0 100%);
}

.card-body {
    padding: 18px;
}

.progress-bar {
    background: #1e293b;
    height: 9px;
    border-radius: 6px;
    margin-top: 12px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    height: 100%;
}

.btn-enter-course {
    width: 100%;
    padding: 9px;
    background-color: rgba(30, 136, 229, 0.15);
    color: var(--primary);
    text-align: center;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid rgba(30, 136, 229, 0.3);
    cursor: pointer;
}

.btn-enter-course:hover {
    background-color: var(--primary);
    color: white;
}

.btn-del-item {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 83, 80, 0.9);
    color: white;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    z-index: 2;
}

/* TARJETAS ESTILO LCTI SPORT */
.exact-sports-card {
    background: #0d1e3a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #1e3a66;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    margin-top: 15px;
    max-width: 950px;
}

.exact-sports-bar {
    color: #64b5f6;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: #0d2b5c;
    border-bottom: 1px solid #1565c0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-upload-banner {
    background: #1e88e5;
    color: white;
    border: none;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.btn-upload-banner:hover {
    background: #1565c0;
}

.exact-banner-a-tag {
    display: block;
    text-decoration: none;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.exact-banner-a-tag:hover {
    transform: scale(1.002);
    filter: brightness(1.02);
}

.banner-custom-img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 380px;
    object-fit: contain;
    background: #000;
}

/* ADMIN & WIDGETS */
.admin-box {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    margin-top: 25px;
    box-shadow: var(--card-shadow);
}

.filter-bar {
    display: flex;
    gap: 15px;
    align-items: center;
    background: #0d1322;
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    border: 1px solid var(--border-color);
}

.user-list {
    margin-top: 12px;
    border-collapse: collapse;
    width: 100%;
}

.user-list th, .user-list td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
    font-size: 14px;
}

.user-list th {
    background-color: #0d1527;
    color: var(--primary);
}

.btn-delete-user {
    background: var(--danger);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.right-widgets {
    width: 260px;
    background: #0d1322;
    border-left: 1px solid var(--border-color);
    padding: 20px 15px;
}

.widget {
    margin-bottom: 25px;
}

/* --- BOLETÍN DE NOTAS --- */
.grades-widget-container {
    background: #0d223a;
    border: 1px solid #1e3a66;
    border-radius: 10px;
    padding: 22px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    color: #ffffff;
    max-width: 1050px;
    margin: 0 auto;
}

.grades-selectors-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 18px;
    background: #112a4a;
    border: 1px solid #1e4976;
    padding: 14px;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .grades-selectors-grid {
        grid-template-columns: 1fr;
    }
}

.grades-selectors-grid label {
    display: block;
    font-size: 12.5px;
    font-weight: bold;
    color: #90caf9;
    margin-bottom: 5px;
}

.grades-selectors-grid select {
    width: 100%;
    padding: 8px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid #1e88e5;
    background: #0a192f;
    color: #ffffff;
}

.grades-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.grades-table th, .grades-table td {
    border: 1px solid #1e3a66;
    padding: 8px;
    text-align: center;
    font-size: 12px;
}

.grades-table th {
    background-color: #0d1527;
    color: #90caf9;
    font-weight: 700;
}

.grades-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: #e2e8f0;
    text-transform: uppercase;
}

.grade-input-field {
    width: 45px;
    font-size: 11px;
    font-weight: bold;
    padding: 3px;
    border: 1px solid #1e88e5;
    border-radius: 4px;
    text-align: center;
    background: #0a192f;
    color: #ffffff;
}

.sub-col-header {
    font-size: 10px;
    color: #94a3b8;
    display: block;
    margin-bottom: 2px;
}

.grade-badge {
    font-weight: 700;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    color: #ffffff;
    min-width: 38px;
    display: inline-block;
    text-align: center;
}

.grade-badge.green { background-color: #22c55e; }
.grade-badge.blue { background-color: #2563eb; }
.grade-badge.yellow { background-color: #eab308; color: #000; }
.grade-badge.red { background-color: #ef4444; }
.grade-badge.na { background-color: transparent; color: #f97316; font-weight: bold; }

/* CALENDARIO OSCURO */
.google-calendar-container {
    background: var(--bg-card);
    border-radius: 18px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    max-width: 980px;
    margin: 0 auto;
}

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

.gcal-nav-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-gcal-today {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
}

.btn-gcal-arrow {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 50%;
    color: var(--text-muted);
}

.gcal-month-title {
    font-size: 22px;
    color: var(--text-main);
    font-weight: 700;
    min-width: 190px;
}

.btn-add-event {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 8px;
}

.gcal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.gcal-day-header {
    text-align: center;
    padding: 12px 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    background: #0d1527;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-transform: uppercase;
}

.gcal-day-cell {
    min-height: 100px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    padding: 6px;
    position: relative;
    cursor: pointer;
}

.gcal-day-cell:hover {
    background: #172033;
}

.gcal-day-cell.other-month {
    background: #0a0e17;
    opacity: 0.3;
}

.gcal-day-number {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    text-align: center;
    width: 24px;
    height: 24px;
    line-height: 24px;
    margin: 0 auto 5px auto;
    border-radius: 50%;
}

.gcal-day-cell.today .gcal-day-number {
    background: var(--primary);
    color: white;
}

.gcal-event {
    background: #1e3a66;
    border: 1px solid var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gcal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-muted);
}

.gcal-branding {
    font-weight: 700;
    color: var(--primary);
    font-size: 15px;
}

/* TRIMESTRES OSCUROS */
.materia-tabs-bar {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 25px;
    background: #0d1527;
    border-radius: 8px 8px 0 0;
    padding-left: 10px;
    padding-top: 10px;
}

.tab-button {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-button:hover {
    color: #64b5f6;
}

.tab-button.active {
    color: white;
    background: var(--bg-card);
    border-color: var(--border-color) var(--border-color) var(--bg-card) var(--border-color);
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    margin-bottom: -1px;
}

.materia-header {
    background: linear-gradient(135deg, #0d2b5c 0%, #1565c0 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.materia-section-box {
    background: var(--bg-card);
    padding: 22px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

/* MODALES OSCUROS */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 450px;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
    animation: fadeIn 0.3s ease;
}

.modal-card h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 18px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 140px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
    background: var(--bg-input);
}

.checkbox-item {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-main);
}
