:root {
    --primary-bg: #001a1a; /* Dark Forest Green */
    --accent-color: #ff9800; /* IPIAM Orange */
    --accent-glow: rgba(255, 152, 0, 0.3);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-dim: #b0bec5;
    --success: #4caf50;
    --warning: #ffc107;
    --danger: #f44336;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
    --tornasol-gradient: linear-gradient(135deg, #004d40 0%, #002b2b 100%);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: var(--tornasol-gradient);
    color: var(--text-main);
    font-family: var(--font-main, 'Outfit', sans-serif);
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

.view {
    display: none;
    opacity: 0;
}

.view.active {
    display: block;
    opacity: 1;
}

/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Login View */
#login-view.active {
    display: flex;
}

#login-view {
    display: none;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-card {
    width: 100%;
    max-width: 450px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.8s ease-out;
}

.logo-container {
    margin-bottom: 2rem;
}

.logo {
    height: 100px;
    width: auto;
    filter: brightness(0) invert(1); /* Hace que el logo oscuro se vea blanco */
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 2rem;
}

#google-login-btn {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.footer-note {
    font-size: 0.85rem;
    border-top: 1px solid var(--border-glass);
    padding-top: 1.5rem;
}

/* Manual Login Styles */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 2rem 0;
    color: var(--text-dim);
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-glass);
}

.divider span {
    padding: 0 10px;
}

.manual-login {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    width: 18px;
}

.input-group input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px 12px 12px 40px;
    color: #fff;
    font-family: inherit;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.primary-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.primary-btn:hover {
    background: #ffa726; /* Lighter Orange */
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

/* Dashboard View */
.top-nav {
    background: rgba(10, 15, 29, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-glass);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    height: 45px;
    filter: brightness(0) invert(1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-name {
    font-weight: 600;
    color: #fff;
}

#logout-btn {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: #fff;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

#logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ff4d4d;
    color: #ff4d4d;
}

/* Main Content */
.dashboard-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.welcome-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 3rem;
}

.stats-grid {
    display: flex;
    gap: 1.5rem;
}

.stat-card {
    padding: 1.5rem 2rem;
    min-width: 180px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

/* Grades Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    width: 18px;
}

.search-box input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px 12px 12px 40px;
    color: #fff;
    font-family: inherit;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.table-container {
    overflow: hidden;
    margin-bottom: 4rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead th {
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-glass);
}

tbody td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 1rem;
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.grade-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    display: inline-block;
    min-width: 45px;
    text-align: center;
}

.grade-high { background: rgba(0, 212, 255, 0.15); color: #00D4FF; }
.grade-mid { background: rgba(255, 171, 0, 0.15); color: #FFAB00; }
.grade-low { background: rgba(255, 77, 77, 0.15); color: #FF4D4D; }
.grade-pending { background: rgba(255, 152, 0, 0.15); color: var(--accent-color); border: 1px solid var(--accent-color); }

.alert-card {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-left: 4px solid var(--accent-color);
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-content p {
    margin: 0 !important;
    color: #fff !important;
    font-size: 0.95rem;
}

.alert-content a {
    color: var(--accent-color);
    text-decoration: underline;
}

.view-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.view-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.loading-cell {
    text-align: center;
    padding: 4rem !important;
    color: var(--text-dim);
}

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .welcome-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        text-align: left;
    }
    
    .stats-grid {
        width: 100%;
        grid-template-columns: 1fr 1fr;
        display: grid;
    }
    
    .stat-card {
        min-width: 0;
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
    
    .search-box {
        width: 100%;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
        border-radius: 0;
    }

    table {
        min-width: 600px; /* Force minimum width for scrolling */
    }

    #student-info {
        font-size: 0.9rem;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
}
