/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #ffab00;
    /* Yellow/Orange match */
    --secondary-color: #1a1f3c;
    /* Dark Sidebar match */
    --bg-color: #f4f6f9;
    --text-color: #333;
    --text-light: #6c757d;
    --white: #ffffff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --border-radius: 12px;
    --sidebar-width: 250px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

a {
    text-decoration: none;
    color: inherit;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-color);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    color: var(--white);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-header {
    padding: 0 20px 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--secondary-color);
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.brand-sub {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    display: block;
}

.nav-category {
    padding: 15px 20px 5px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    gap: 15px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-left: 4px solid var(--primary-color);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(255, 171, 0, 0.1) 0%, rgba(255, 171, 0, 0) 100%);
    color: var(--primary-color);
}

.nav-icon {
    width: 20px;
    text-align: center;
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* Custom scrollbar for nav-menu */
.nav-menu::-webkit-scrollbar {
    width: 6px;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.user-profile-bottom {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 20px 30px;
    min-height: 100vh;
}

/* Dropdown Menu Styles */
.dropdown-menu-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: rgba(0, 0, 0, 0.15);
    display: none;
}

.dropdown-menu-items.show {
    max-height: 500px;
    /* Adjust as needed */
    transition: max-height 0.5s ease-in;
    display: block;
}

.sub-link {
    padding-left: 55px !important;
    font-size: 0.85rem !important;
    border-left: none !important;
}

.caret-icon {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.rotate {
    transform: rotate(180deg);
}

.nav-link.active .caret-icon {
    color: var(--primary-color);
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--white);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.search-bar {
    display: flex;
    align-items: center;
    background: #f0f2f5;
    padding: 10px 20px;
    border-radius: 30px;
    width: 300px;
}

.search-input {
    border: none;
    background: transparent;
    outline: none;
    margin-left: 10px;
    width: 100%;
    font-family: inherit;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-icon {
    position: relative;
    cursor: pointer;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: var(--white);
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 50%;
}

/* Dashboard Widgets */
.dashboard-title {
    margin-bottom: 20px;
}

.welcome-text {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card.dark {
    background: var(--secondary-color);
    color: var(--white);
}

.stat-card.primary {
    background: var(--primary-color);
    color: var(--secondary-color);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.stat-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success);
}

.badge-light {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

/* Charts & Activity */
.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.chart-card,
.activity-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.activity-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.activity-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.activity-info h4 {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 171, 0, 0.2);
}

.btn {
    padding: 12px 25px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--secondary-color);
}

.btn-primary:hover {
    filter: brightness(0.9);
}

/* Login Page */
.login-body {
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: 20px;
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-logo {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .mobile-toggle {
        display: block !important;
    }

    .topbar {
        padding: 10px 15px;
        margin-bottom: 20px;
    }

    .search-bar {
        width: 150px;
        padding: 8px 15px;
    }

    .search-bar i {
        font-size: 0.8rem;
    }

    .search-input {
        font-size: 0.8rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid-2 {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .topbar-right span {
        display: none;
    }

    /* Table Responsiveness */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 20px;
    }

    table {
        min-width: 600px;
    }

    /* Form Grids Adjustments */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Adjust cards and paddings */
    .card,
    .chart-card,
    .activity-card {
        padding: 15px !important;
    }

    .dashboard-title h2 {
        font-size: 1.4rem;
    }

    .welcome-text {
        margin-bottom: 20px;
    }

    /* Teachers/Users specific grids */
    .teachers-grid,
    .users-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .search-bar {
        display: none;
    }

    .topbar-right {
        gap: 10px;
    }
}

/* Global utility for responsive tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}