/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

:root {
    --primary: #6C63FF;       /* Main Purple */
    --secondary: #2A2A72;     /* Dark Blue Text */
    --accent: #009FFD;        /* Light Blue */
    --bg: #F4F6F9;            /* Light Grey Background */
    --white: #ffffff;
    --text-dark: #333;
    --text-light: #888;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --glass: rgba(255, 255, 255, 0.95);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }

body {
    background-color: var(--bg);
    color: var(--text-dark);
    font-size: 14px;
}

/* =========================================
   2. LOGIN PAGE STYLES
   ========================================= */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    padding: 20px;
}

.login-card {
    background: var(--glass);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 { margin-bottom: 20px; color: var(--secondary); }

.input-group { margin-bottom: 15px; text-align: left; }
.input-group label { font-size: 12px; font-weight: 600; color: #666; display: block; margin-bottom: 5px; }
.input-group input {
    width: 100%; padding: 12px; border: 2px solid #eee; border-radius: 10px; outline: none; transition: 0.3s;
}
.input-group input:focus { border-color: var(--primary); }

.btn-login {
    width: 100%; padding: 12px; background: var(--primary); color: white; border: none; border-radius: 10px;
    font-size: 16px; font-weight: 600; cursor: pointer; transition: 0.3s;
}
.btn-login:hover { background: var(--secondary); transform: translateY(-2px); }

/* =========================================
   3. DASHBOARD LAYOUT (GRID)
   ========================================= */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 280px 1fr; /* Sidebar (280px) + Content (Rest) */
    gap: 30px;
    min-height: 100vh;
}

/* Sidebar / Profile Card */
.profile-card {
    background: var(--white);
    padding: 30px 20px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    height: fit-content;
}

.profile-img {
    width: 90px; height: 90px; background: #eee; border-radius: 50%; margin: 0 auto 15px;
    background-image: url('https://cdn-icons-png.flaticon.com/512/3135/3135715.png');
    background-size: cover; border: 3px solid var(--primary);
}

.btn-logout {
    display: inline-block; margin-top: 15px; padding: 8px 25px; background: #FFEDF0; color: #FF0055;
    text-decoration: none; border-radius: 50px; font-size: 14px; font-weight: 600; transition: 0.3s;
}
.btn-logout:hover { background: #FF0055; color: white; }

/* =========================================
   4. DASHBOARD COMPONENTS
   ========================================= */
/* Section Titles */
.section-title {
    font-size: 18px; font-weight: 600; margin-bottom: 15px; color: var(--secondary);
    border-left: 4px solid var(--primary); padding-left: 10px;
}

/* Action Buttons Grid */
.action-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; margin-bottom: 25px;
}
.action-btn {
    background: var(--white); padding: 20px; border-radius: 15px; text-align: center; text-decoration: none;
    box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: transform 0.2s, border 0.2s; border: 1px solid transparent; color: var(--text-dark);
}
.action-btn:hover { transform: translateY(-5px); border-color: var(--primary); }
.action-icon {
    font-size: 24px; color: var(--primary); background: #EEECFF; width: 50px; height: 50px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%; margin-bottom: 10px;
}
.action-label { color: var(--secondary); font-weight: 600; font-size: 13px; }

/* Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px;}
.stat-card { background: var(--white); padding: 20px; border-radius: 15px; box-shadow: var(--shadow); }
.stat-card h4 { font-size: 11px; text-transform: uppercase; color: #888; letter-spacing: 0.5px; }
.stat-card .value { font-size: 22px; font-weight: 700; margin-top: 5px; color: #333; }

/* Tables */
.table-card { background: var(--white); padding: 20px; border-radius: 15px; box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; vertical-align: middle; }
th { color: #888; font-size: 12px; font-weight: 600; }
.badge { padding: 5px 10px; border-radius: 20px; font-size: 11px; font-weight: bold; display: inline-block;}
.badge.paid { background: #d4edda; color: #155724; }
.badge.pending { background: #fff3cd; color: #856404; }

/* =========================================
   5. SPECIAL STYLES (Attendance & Marks)
   ========================================= */
/* Attendance Radio Switch */
.radio-switch {
    display: flex; gap: 5px; background: #f0f0f0; padding: 4px; border-radius: 30px; width: fit-content;
}
.radio-switch input { display: none; }
.radio-switch label {
    padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: 11px; font-weight: 600; transition: 0.3s;
}
input[value="Present"]:checked + label { background: #00C853; color: white; }
input[value="Absent"]:checked + label { background: #FF0055; color: white; }

/* =========================================
   6. MOBILE RESPONSIVENESS (CRITICAL)
   ========================================= */
@media (max-width: 768px) {
    /* Login Page */
    .login-card { padding: 30px 20px; }

    /* Dashboard Layout - STACK EVERYTHING */
    .dashboard-container {
        display: flex; flex-direction: column; padding: 15px; width: 100%; gap: 20px;
    }

    /* Move Sidebar to Top */
    .profile-card { width: 100%; margin-bottom: 10px; }

    /* Grids */
    .action-grid { grid-template-columns: repeat(2, 1fr); } /* 2 buttons per row */
    .stats-grid { grid-template-columns: 1fr; } /* 1 stat per row */
    
    /* Fix for Manage Marks Page (Form + Table) */
    .dashboard-container > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}
