:root {
    --primary-color: #6c5ce7;
    --primary-light: #a29bfe;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --success-color: #00b894;
    --accent-color: #fdcb6e;
    --accent-light: #f1c40f;
    --bg-color: #f5f6fa;
    --white: #ffffff;
    --surface-color: #ffffff;
    --danger-color: #d63031;
    --border-radius: 16px;
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 8px 30px rgba(15, 15, 15, 0.08);
    --font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;

    /* Support variables for inline styles */
    --mustard: #d4a017;
    --deep-red: #9b1e1e;
    --muted: #6b6b6b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(180deg, var(--bg-color), #fff);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    color: var(--text-primary);
}

.mobile-container {
    width: 100%;
    max-width: 520px;
    background: transparent;
    min-height: 100vh;
    position: relative;
    padding: 12px;
    padding-bottom: 90px;
}

/* Typography */
h1,
h2,
h3,
h4,
h5 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

p {
    color: var(--text-secondary);
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Buttons */
.btn-app {
    display: block;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--primary-color), #7a1414);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(155, 30, 30, 0.2);
    transition: transform 0.2s;
}

.btn-app:active {
    transform: scale(0.98);
}

/* Form Styles */
.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: var(--shadow-sm);
    font-size: 16px;
    outline: none;
    font-family: inherit;
}

.form-label {
    position: absolute;
    left: 16px;
    top: 16px;
    color: #999;
    pointer-events: none;
    transition: 0.2s ease all;
}

.form-control:focus~.form-label,
.form-control:not(:placeholder-shown)~.form-label {
    top: -10px;
    left: 10px;
    font-size: 11px;
    background: var(--bg-color);
    padding: 0 8px;
    color: var(--primary-color);
    font-weight: 600;
    border-radius: 4px;
}

/* === Layout Components from Test.php === */

/* Topbar */
.topbar {
    background: linear-gradient(135deg, var(--primary-color), #7a1414 60%);
    color: #fff;
    padding: 20px;
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.topbar:before {
    content: "";
    position: absolute;
    inset: -50px -50px;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05), transparent 40%);
    pointer-events: none;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-badge {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--primary-color);
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
}

.notification-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: white;
    font-size: 18px;
    position: relative;
}

.badge-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--accent-light);
    border-radius: 50%;
    border: 1px solid var(--primary-color);
}

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

/* Stats */
.stat-title {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.progress-wrap {
    height: 8px;
    background: #f1f2f6;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
    border-radius: 10px;
}

/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
}

.action-icon {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 20px;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
    transition: transform 0.2s;
}

.action-item:active .action-icon {
    transform: scale(0.95);
}

.action-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* AI Section */
.ai-section {
    background: linear-gradient(135deg, #2c3e50, #000000);
    border-radius: var(--border-radius);
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.ai-section::after {
    content: "";
    position: absolute;
    right: -20px;
    top: -20px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 50%;
}

.ai-content h3 {
    font-size: 18px;
    margin-bottom: 4px;
    color: white;
}

.ai-content p {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 0;
    color: #dfe6e9;
}

.btn-ai {
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
    color: #581400;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(212, 160, 23, 0.3);
}

/* Notices List */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.view-all {
    font-size: 13px;
    color: var(--primary-color);
    font-weight: 600;
}

.notice-item {
    background: white;
    padding: 16px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 16px;
}

.notice-icon {
    width: 48px;
    height: 48px;
    background: rgba(155, 30, 30, 0.08);
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--primary-color);
    font-size: 20px;
    flex-shrink: 0;
}

.notice-text h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.notice-text p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.notice-time {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
    display: block;
}

/* Calendar */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.cal-head {
    font-size: 11px;
    text-align: center;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 8px;
}

.cal-date {
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.cal-date.present {
    background: var(--success-color);
    color: white;
}

.cal-date.absent {
    background: var(--danger-color);
    color: white;
}

.cal-date.today {
    outline: 2px dotted #6888ff;
    background-color: #fff;
    color: #3460d5;
}

.cal-date.empty {
    background: transparent;
}

/* Bottom Nav */
/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 520px;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 15px 10px;
    display: flex;
    justify-content: space-between;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    text-align: center;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 50px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.nav-item i {
    font-size: 20px;
}

.nav-item span {
    font-size: 10px;
    font-weight: 600;
}

.nav-item.active {
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
    color: #581400;
    box-shadow: 0 4px 15px rgba(212, 160, 23, 0.25);
}

.nav-item.active i {
    color: #581400;
}

/* AI Teacher Section - Colorful & Glowing */
@keyframes glowing-border {
    0% {
        box-shadow: 0 0 5px #ff00cc, 0 0 10px #ff00cc, 0 0 15px #ff00cc;
        border-color: #ff00cc;
    }

    50% {
        box-shadow: 0 0 10px #3333ff, 0 0 20px #3333ff, 0 0 30px #3333ff;
        border-color: #3333ff;
    }

    100% {
        box-shadow: 0 0 5px #ff00cc, 0 0 10px #ff00cc, 0 0 15px #ff00cc;
        border-color: #ff00cc;
    }
}

@keyframes gradient-bg {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}


.ai-teacher-section {
    position: relative;
    margin: 0 20px 25px 20px;
    border-radius: 20px;
    /* Use the same gradient and glow as btn-glow */
    background: linear-gradient(45deg, #6c5ce7, #a29bfe);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
    animation: glow-pulse 2s infinite;
    overflow: hidden;
}

.ai-teacher-inner {
    background: transparent;
    /* Transparent so parent gradient shows */
    border-radius: 18px;
    /* Slightly smaller if we had padding, but now main container has radius 20. inner can match or be transparent */
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    width: 100%;
    position: relative;
    z-index: 2;
}

/* Remove solid override as parent has gradient */
.ai-teacher-inner.solid {
    background: transparent;
}

.ai-teacher-content {
    flex: 1;
    padding-right: 15px;
    min-width: 0;
    /* Crucial for text wrapping in flex */
}

.ai-teacher-content h3 {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 5px 0;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ai-teacher-content p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 15px 0;
    font-weight: 500;
    line-height: 1.4;
}

.ai-btn {
    background: #fff;
    color: #6c5ce7;
    border: none;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.ai-btn:hover,
.ai-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.ai-icon-glow {
    font-size: 45px;
    /* Slightly smaller for safety */
    color: #fff;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.6));
    animation: float 3s ease-in-out infinite;
    flex-shrink: 0;
    /* Prevent shrinking */
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Performance Section Styles */
.perf-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    background: #fdfdfd;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.perf-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sub-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: #fff;
    flex-shrink: 0;
    font-size: 18px;
}

.sub-icon.eng {
    background: linear-gradient(90deg, #d4a017, #d3941e);
}

.sub-icon.math {
    background: linear-gradient(90deg, #9b1e1e, #7a1414);
}

.sub-icon.sci {
    background: linear-gradient(90deg, #4caf50, #388e3c);
}

.sub-icon.hin {
    background: linear-gradient(90deg, #2196f3, #1976d2);
}

.sub-icon.sst {
    background: linear-gradient(90deg, #9c27b0, #7b1fa2);
}

.muted {
    color: #6b6b6b;
    font-size: 12px;
}

/* --- GLOBAL HEADER STYLES --- */
/* Attendance Calendar Styles */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.cal-day {
    font-size: 11px;
    text-align: center;
    color: #6b6b6b;
    /* Exact muted color from test.php */
    font-weight: 700;
}

.cal-date {
    min-height: 36px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 14px;
}

.cal-date.present {
    background: linear-gradient(180deg, #d4a017, #e5a92a);
    /* Fixed Mustard color from test.php */
    color: #7a2b00;
}

.cal-date.absent {
    background: #ffe6e6;
    color: #9b1e1e;
    /* Fixed Deep Red color from test.php */
}

.cal-date.today {
    outline: 2px solid rgba(155, 30, 30, 0.12);
    box-shadow: inset 0 -6px 18px rgba(155, 30, 30, 0.04);
}

/* Left Side: Logo */
.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.2);
}

.brand-info h1 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-info span {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Right Side: Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notif-btn {
    position: relative;
    color: var(--text-primary);
    font-size: 20px;
    text-decoration: none;
    padding: 5px;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background-color: #ff7675;
    border-radius: 50%;
    border: 2px solid #fff;
}

.profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--bg-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}


/* Glowing Pay Button */
.pay-now-container {
    text-align: center;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
}

.btn-glow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(45deg, #6c5ce7, #a29bfe);
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
    animation: glow-pulse 2s infinite;
}

.btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.6);
}

.btn-glow i {
    font-size: 18px;
}

@keyframes glow-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(108, 92, 231, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(108, 92, 231, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(108, 92, 231, 0);
    }
}

/* --- Stats Carousel (Horizontal Scroll) --- */
.stats-carousel-wrapper {
    overflow-x: auto;
    padding: 10px 20px 25px 20px;
    display: flex;
    gap: 15px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-right: 0;
}

.stats-carousel-wrapper::-webkit-scrollbar {
    display: none;
}

.stats-card {
    min-width: 140px;
    height: 140px;
    background: white;
    border-radius: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    scroll-snap-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.stats-card:active {
    transform: scale(0.96);
}

/* Colorful Variants with Light Backgrounds */
.stats-card.st-attendance {
    background: linear-gradient(145deg, #e8f5e9, #ffffff);
    border: 1px solid #c8e6c9;
}

.stats-card.st-attendance .stat-icon {
    color: #00b894;
    background: white;
    box-shadow: 0 4px 10px rgba(0, 184, 148, 0.15);
}

.stats-card.st-grade {
    background: linear-gradient(145deg, #fff8e1, #ffffff);
    border: 1px solid #ffecb3;
}

.stats-card.st-grade .stat-icon {
    color: #fbc531;
    background: white;
    box-shadow: 0 4px 10px rgba(253, 203, 110, 0.15);
}

.stats-card.st-exam {
    background: linear-gradient(145deg, #f3e5f5, #ffffff);
    border: 1px solid #e1bee7;
}

.stats-card.st-exam .stat-icon {
    color: #8e44ad;
    background: white;
    box-shadow: 0 4px 10px rgba(142, 68, 173, 0.15);
}

.stats-card.st-fees {
    background: linear-gradient(145deg, #fbe9e7, #ffffff);
    border: 1px solid #ffccbc;
}

.stats-card.st-fees .stat-icon {
    color: #e17055;
    background: white;
    box-shadow: 0 4px 10px rgba(225, 112, 85, 0.15);
}

/* Hover Effects */
.stats-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 5px;
    line-height: 1;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}