/* ==========================================================================
   1. RESET & VARIABLES - WINE THEME
   ========================================================================== */
:root {
    --primary-navy: #800000;     /* Changed to Wine */
    --primary-wine: #800000;     /* Wine color */
    --accent-gold: #FFD700;      /* Gold accent */
    --secondary-navy: #001f3f;   /* Keep navy as secondary */
    
    --bg-main: #f4f6f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    
    --text-dark: #2d3748;
    --text-muted: #64748b;
    --text-light: #f8fafc;
    
    --sidebar-width: 250px;
    --navbar-height: 65px;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --transition-fast: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   2. NAVBAR - WINE THEME
   ========================================================================== */
.navbar {
    height: var(--navbar-height);
    background: linear-gradient(135deg, #800000 0%, #660000 50%, #4d0000 100%);
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.nav-brand i {
    color: var(--accent-gold);
    font-size: 1.5rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background-color: var(--accent-gold);
    color: var(--primary-wine);
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    background-color: rgba(255, 255, 255, 0.15);
}

.btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color var(--transition-fast);
}

.btn-logout {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   3. APP LAYOUT & SIDEBAR
   ========================================================================== */
.app-container {
    display: flex;
    margin-top: var(--navbar-height);
    flex: 1;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #800000 0%, #4d0000 100%);
    color: #ffffff;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    position: fixed;
    top: var(--navbar-height);
    bottom: 0;
    left: 0;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 4px solid transparent;
}

.sidebar-nav li a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-nav li a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-nav li a.active {
    background-color: rgba(255, 215, 0, 0.12);
    color: var(--accent-gold);
    border-left-color: var(--accent-gold);
    font-weight: 600;
}

.sidebar-nav .divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.08);
    margin: 1rem 0;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    max-width: calc(100vw - var(--sidebar-width));
}

/* ==========================================================================
   4. WELCOME BANNER - WINE THEME
   ========================================================================== */
.welcome-banner {
    background: linear-gradient(135deg, #800000 0%, #660000 40%, #4d0000 100%);
    color: #ffffff;
    padding: 2rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.welcome-banner h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.welcome-banner .gold {
    color: var(--accent-gold);
}

.welcome-banner p {
    color: #e2e8f0;
    font-size: 0.95rem;
}

.welcome-stats {
    display: flex;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(5px);
}

.welcome-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-stat .number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.welcome-stat .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #e2e8f0;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   5. SECTIONS & CARDS GENERAL
   ========================================================================== */
.section-title {
    margin: 2.5rem 0 1.25rem 0;
}

.section-title h3 {
    font-size: 1.25rem;
    color: var(--primary-wine);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title h3 .gold {
    color: var(--accent-gold);
}

.section-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Borders - Wine Theme */
.gold-border { border-top: 4px solid var(--accent-gold) !important; }
.wine-border { border-top: 4px solid var(--primary-wine) !important; }

/* ==========================================================================
   6. KPI CARDS
   ========================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--border-color);
    border-bottom: 4px solid var(--primary-wine);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.kpi-card.gold-border {
    border-bottom-color: var(--accent-gold);
}

.kpi-card.wine-border {
    border-bottom-color: var(--primary-wine);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.15rem 0;
}

.kpi-change.positive {
    font-size: 0.75rem;
    color: #16a34a;
    font-weight: 600;
}

/* ==========================================================================
   7. TERMS GRID
   ========================================================================== */
.terms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.term-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-left: 4px solid #dee2e6;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.term-card.active {
    border-left-color: var(--accent-gold);
    background: #f8f9fc;
}

.term-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.term-header h4 {
    font-size: 1.1rem;
    color: var(--primary-wine);
}

.term-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.term-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-size: 0.85rem;
    color: var(--text-dark);
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

.term-stats i {
    color: var(--accent-gold);
    width: 18px;
}

.term-goals p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.term-goals .gold {
    color: var(--accent-gold);
}

.term-classes {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.class-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.class-tag {
    background: #f0f2f5;
    font-size: 0.75rem;
    padding: 0.25rem 0.8rem;
    border-radius: 12px;
    color: var(--text-dark);
}

/* ==========================================================================
   8. CLASSES & GOAL GRID
   ========================================================================== */
.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.class-card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-wine);
    box-shadow: var(--shadow-sm);
}

.class-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0.75rem;
}

.class-header h4 {
    color: var(--primary-wine);
    font-size: 1rem;
}

.class-teacher {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.class-teacher i {
    color: var(--accent-gold);
}

.class-students {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.student-item {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.3rem 0;
    border-bottom: 1px solid #f8f9fc;
}

.student-item:last-child {
    border-bottom: none;
}

.goal-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.goal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1.5rem;
    text-align: center;
}

.goal-stat .number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-wine);
    display: block;
}

.goal-stat .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ==========================================================================
   9. EVENTS & COMMITMENT - WINE THEME
   ========================================================================== */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.event-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-wine);
    display: flex;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.event-card.wine-border {
    border-left-color: var(--primary-wine);
}

.event-card.gold-border {
    border-left-color: var(--accent-gold);
}

.event-date {
    width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    background: var(--primary-wine);
}

.event-date .day {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.event-date .month {
    font-size: 0.75rem;
    font-weight: 600;
}

.event-date.gold-date {
    background: var(--accent-gold);
    color: var(--primary-wine);
}

.event-content {
    padding: 1rem 1.25rem;
}

.event-content h4 {
    font-size: 0.95rem;
    color: var(--text-dark);
}

.event-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Commitment Card - Wine Theme */
.commitment-card {
    background: linear-gradient(135deg, #800000 0%, #4d0000 50%, #330000 100%);
    color: #ffffff;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    margin-top: 2.5rem;
    text-align: center;
}

.commitment-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.commitment-card h3 .gold {
    color: var(--accent-gold);
}

.commitment-card p {
    opacity: 0.85;
    max-width: 600px;
    margin: 0 auto;
}

.commitment-tags {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.commitment-tags span {
    background: rgba(255, 255, 255, 0.12);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    font-size: 0.85rem;
}

.commitment-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.commitment-footer p {
    color: var(--accent-gold);
    letter-spacing: 0.5px;
    font-weight: 600;
    font-size: 1.1rem;
}

/* ==========================================================================
   10. STATS GRID (Quick Stats)
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border-bottom: 4px solid var(--primary-wine);
    transition: all var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-wine);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-card.gold {
    border-bottom-color: var(--accent-gold);
}

.stat-card.maroon {
    border-bottom-color: var(--primary-wine);
}

.stat-card.navy {
    border-bottom-color: #001f3f;
}

/* ==========================================================================
   11. QUICK ACTIONS
   ========================================================================== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.action-btn {
    background: #f8f9fc;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-dark);
    text-align: center;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
}

.action-btn:hover {
    background: var(--primary-wine);
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.action-btn i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.action-btn span {
    font-size: 0.8rem;
    font-weight: 500;
}

/* ==========================================================================
   12. CARDS (General)
   ========================================================================== */
.card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.card h3 {
    color: var(--primary-wine);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.card h3 .gold {
    color: var(--accent-gold);
}

.info-card p {
    padding: 0.4rem 0;
    color: var(--text-muted);
    border-bottom: 1px solid #f8f9fc;
}

.info-card p:last-child {
    border-bottom: none;
}

/* ==========================================================================
   13. PAGE HEADER & BADGES
   ========================================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    color: var(--primary-wine);
}

.page-header h2 i {
    color: var(--accent-gold);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: var(--primary-wine);
    color: #ffffff;
}

.badge-teacher {
    background: var(--accent-gold);
    color: var(--primary-wine);
}

.badge-staff {
    background: #001f3f;
    color: #ffffff;
}

.badge-info {
    background: #17a2b8;
    color: #ffffff;
}

/* ==========================================================================
   14. FORMS
   ========================================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.form-group label i {
    color: var(--primary-wine);
    width: 20px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-wine);
    outline: none;
    box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ==========================================================================
   15. BUTTONS
   ========================================================================== */
.btn-primary {
    background: linear-gradient(135deg, #800000, #660000);
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(128, 0, 0, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: #ffffff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}

.btn-group {
    display: flex;
    gap: 0.25rem;
}

.btn-info {
    background: #17a2b8;
    color: #ffffff;
}

.btn-info:hover {
    background: #138496;
}

.btn-warning {
    background: #ffc107;
    color: #1a1a2e;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: #dc3545;
    color: #ffffff;
}

.btn-danger:hover {
    background: #c82333;
}

/* ==========================================================================
   16. ALERTS
   ========================================================================== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ==========================================================================
   17. TABLES
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: #f8f9fc;
    color: var(--text-dark);
    font-weight: 600;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #f0f2f5;
    font-size: 0.9rem;
}

.table tr:hover td {
    background: #f8f9fc;
}

/* ==========================================================================
   18. FOOTER
   ========================================================================== */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-card);
    margin-top: auto;
}

/* ==========================================================================
   19. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .welcome-stats {
        width: 100%;
        justify-content: space-around;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }

    .sidebar-nav li a span {
        display: none;
    }

    .sidebar-nav li a {
        justify-content: center;
        padding: 1rem;
    }

    .main-content {
        margin-left: 70px;
        max-width: calc(100vw - 70px);
        padding: 1rem;
    }

    .user-name, .user-role {
        display: none;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .classes-grid {
        grid-template-columns: 1fr;
    }
    
    .terms-grid {
        grid-template-columns: 1fr;
    }
    
    .events-grid {
        grid-template-columns: 1fr;
    }
    
    .goal-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .welcome-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .welcome-stat {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .goal-stats {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }
    
    .navbar {
        padding: 0 1rem;
    }
}