:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --bg-color: #f3f4f6;
    --sidebar-bg: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-areas: 
        "my-sidebar my-navbar"
        "my-sidebar main"
        "my-sidebar my-footer"
    ;
}

body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

my-sidebar {
    grid-area: my-sidebar;
}

my-navbar {
    grid-area: my-navbar;
    top: 0;
    position: sticky;
    width: 100%;
}

main {
    grid-area: main;
    scrollbar-width: none;  /* Firefox */
}

my-footer {
    grid-area: my-footer;
}

/* --- Sidebar Styling --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
    transition: transform var(--transition-speed) ease-in-out;
    display: flex;
    flex-direction: column;
}

.logo-container {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    padding: 10px 10px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
}

/* Dropdown Styling (Sidebar) */
.nav-group {
    margin-bottom: 5px;
}

.dropdown-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
}

.dropdown-toggle:hover {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.dropdown-toggle span.material-symbols-outlined {
    margin-right: 12px;
    font-size: 20px;
}

.dropdown-arrow {
    margin-left: auto;
    font-size: 18px;
    transition: transform 0.3s;
}

.dropdown-toggle.active {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.dropdown-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: 10px;
}

.submenu.open {
    max-height: 500px;
}

.submenu a {
    display: flex;
    align-items: center;
    padding: 10px 16px 10px 46px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.2s;
}

.submenu a:hover {
    color: var(--primary-color);
    background-color: #f9fafb;
}

.submenu a.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Standard Nav Items */
.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item:hover {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.nav-item.active {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.nav-item span.material-symbols-outlined {
    margin-right: 12px;
    font-size: 20px;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 16px 8px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* --- Main Content Styling --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) ease-in-out;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* --- Navbar Styling --- */
.top-navbar {
    height: var(--header-height);
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    display: none;
}

.search-bar {
    display: none;
    background: var(--bg-color);
    padding: 8px 16px;
    border-radius: 20px;
    width: 300px;
    align-items: center;
    gap: 8px;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    position: relative;
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- User Profile Dropdown Styling --- */
.user-profile-container {
    position: relative;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-profile:hover {
    background-color: #f9fafb;
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}

.profile-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* The Dropdown Menu */
.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 240px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
}

.dropdown-header p:first-child {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.dropdown-header p:last-child {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: background 0.2s;
    gap: 12px;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
    color: var(--primary-color);
}

.dropdown-item span.material-symbols-outlined {
    font-size: 20px;
    color: var(--text-muted);
}

.dropdown-item:hover span.material-symbols-outlined {
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 5px 10px;
}

.logout-item:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

.logout-item:hover span.material-symbols-outlined {
    color: #dc2626;
}

/* --- Dashboard Content --- */
.content-area {
    padding: 24px;
}

.page-title {
    margin-bottom: 24px;
    font-size: 1.5rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.stat-icon {
    background: #eff6ff;
    color: var(--primary-color);
    padding: 12px;
    border-radius: 8px;
}

.recent-table {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f9fafb;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-paid { background: #dcfce7; color: #166534; }
.status-pending { background: #fef9c3; color: #854d0e; }
.status-overdue { background: #fee2e2; color: #991b1b; }

/* --- Responsive Logic --- */
@media (max-width: 1024px) {
    .search-bar {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .toggle-btn {
        display: block;
    }

    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 45;
    }
    
    .overlay.active {
        display: block;
    }
    
    /* Hide name on very small screens */
    .profile-info {
        display: none;
    }
}

@media (max-width: 360px) {
     #page-title {
         font-size: 20px;
    }

    .stat-info h1 {
         font-size: 25px:
    }

     .stat-info h3 {
         font-size: 20px:
    }

     .stat-info p  {
         font-size: 15px;
    }
}