/* css/dashboard.css */

/* --- GLOBAL LAYOUT FIXES --- */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    position: relative;
}

.dash-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg);
    width: 100%;
    overflow-x: hidden;
}

/* --- SIDEBAR (PC & DEFAULT) --- */
.sidebar {
    width: 260px;
    background-color: var(--secondary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 1.4rem;
    margin: 0;
    font-family: 'Baloo 2', cursive;
}

.student-card-mini {
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.student-card-mini .avatar,
.student-card-mini img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.student-card-mini h4 {
    color: white;
    margin: 0 0 4px 0;
    font-family: 'Hind', sans-serif;
    font-size: 1rem;
}

.sidebar-nav {
    padding: 15px 0;
    flex: 1;
}

.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    color: #cbd5e1;
    font-weight: 500;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    font-size: 0.95rem;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255, 107, 53, 0.15);
    color: white;
    border-left-color: var(--primary);
}

/* --- MAIN CONTENT & NAVBAR --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - 260px);
    box-sizing: border-box;
}

.dash-navbar {
    background: var(--card-bg);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 70px;
    box-sizing: border-box;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.nav-left h2 {
    margin: 0;
    font-size: 1.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Baloo 2', cursive;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.plan-free { background: #f1f5f9; color: #64748b; }
.plan-premium { background: var(--accent); color: #000; }

.dash-container {
    padding: 25px;
    flex: 1;
    box-sizing: border-box;
    width: 100%;
}

/* --- STATS GRID --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--card-bg);
    padding: 18px;
    border-radius: var(--br-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--br-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-info h3 {
    font-size: 1.4rem;
    margin: 0;
    color: var(--secondary);
}

.stat-info p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* --- MOBILE RESPONSIVE OVERHAUL (PERFECT FIT) --- */
.mobile-only { display: none; }

.sidebar-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99998;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 992px) {
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .mobile-only {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        font-size: 1.4rem;
        cursor: pointer;
        color: var(--secondary);
        padding: 4px;
    }

    .sidebar-header .mobile-only {
        color: white;
    }

    /* PERFECT MOBILE SIDEBAR */
    .sidebar {
        width: 270px !important;
        max-width: 82vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 99999 !important;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0) !important;
    }

    /* PERFECT MOBILE NAVBAR (NO OVERFLOW) */
    .dash-navbar {
        padding: 10px 15px !important;
        height: 60px !important;
        width: 100% !important;
    }

    .nav-left h2 {
        font-size: 1.1rem !important;
    }

    .dash-container {
        padding: 12px !important;
    }

    /* CARDS & FORMS MOBILE PADDING FIX */
    .profile-container {
        width: 100% !important;
    }

    .profile-header, .profile-form-card, .admin-section, .widget-card {
        padding: 15px !important;
        border-radius: 12px !important;
        margin-bottom: 15px !important;
    }

    .profile-header {
        gap: 15px !important;
        text-align: center;
        flex-direction: column;
    }

    .avatar-wrapper {
        width: 85px !important;
        height: 85px !important;
    }

    .form-row {
        flex-direction: column !important;
        gap: 0 !important;
    }

    .form-group {
        margin-bottom: 12px !important;
    }

    .form-control {
        font-size: 0.9rem !important;
        padding: 10px 12px !important;
    }
}