/* Dashboard Shared Styles */
:root {
    --dash-bg: #f8fafc;
    --dash-sidebar: #ffffff;
    --dash-card: #ffffff;
    --dash-text: #1e293b;
    --dash-muted: #64748b;
    --dash-border: #e2e8f0;
    --dash-primary: var(--primary);
    /* Inherit from main */
    --dash-secondary: var(--secondary);
}

body {
    background-color: var(--dash-bg);
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: calc(100vh - 80px);
    /* Height minus navbar */
    gap: 0;
}

/* Sidebar */
.dash-sidebar {
    background: var(--dash-sidebar);
    border-right: 1px solid var(--dash-border);
    padding: 2rem 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--dash-border);
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: var(--surface-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
}

.user-info h4 {
    font-size: 0.95rem;
    margin: 0;
    color: var(--dash-text);
}

.user-info span {
    font-size: 0.8rem;
    color: var(--dash-muted);
}

.dash-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--dash-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.dash-link:hover,
.dash-link.active {
    background: #ecfdf5;
    /* Light green tint matching brand */
    color: var(--primary);
}

.dash-link i {
    width: 20px;
}

/* Main Content */
.dash-content {
    padding: 2rem 3rem;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.dash-header h1 {
    font-size: 1.8rem;
    color: var(--dash-text);
    font-weight: 700;
    letter-spacing: -0.025em;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--dash-card);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    border: 1px solid var(--dash-border);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--dash-muted);
    font-size: 0.9rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dash-text);
}

.stat-detail {
    font-size: 0.85rem;
    color: #10b981;
    /* Green for positive growth */
    margin-top: 4px;
}

/* Listings Grid (Dashboard Variant) */
.dash-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--dash-border);
}

.dash-section-header h2 {
    font-size: 1.2rem;
    color: var(--dash-text);
    margin: 0;
}

/* Responsive Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--dash-border);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* Force scroll on small screens */
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--dash-border);
    font-size: 0.9rem;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--dash-text);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .dash-sidebar {
        display: flex;
        /* We need it valid for transition, but positioned off-screen */
        flex-direction: column;
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px;
        height: 100vh;
        z-index: 2000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
        background: var(--dash-sidebar);
    }

    /* Adjust for layouts with Navbar (Host/Roomie) */
    body:has(.navbar) .dash-sidebar {
        top: 70px;
        height: calc(100vh - 70px);
    }

    .dash-sidebar.mobile-open {
        left: 0;
    }

    .dash-content {
        padding: 1.5rem;
        padding-top: 4rem;
        /* Space for the mobile button */
    }
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: white;
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    background: var(--surface-light);
    color: var(--primary);
}

/* Adjust button position if Navbar exists */
body:has(.navbar) .mobile-menu-btn {
    top: 90px;
    /* 70px navbar + 20px gap */
}

@media (max-width: 900px) {
    .mobile-menu-btn {
        display: block;
    }
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1005;
    /* Below sidebar (2000) */
    opacity: 0;
    transition: opacity 0.3s;
}

body:has(.navbar) .sidebar-overlay {
    top: 70px;
    height: calc(100vh - 70px);
}

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