/* =========================================
   Dashboard System Styles
   ========================================= */

.dashboard-page {
    background-color: var(--bg-alt);
    min-height: 100vh;
}

.dashboard-container {
    display: flex;
    flex-direction: row; /* Horizontal layout for sidebar */
    min-height: 100vh;
}

/* Real Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-main);
    border-right: 1px solid var(--border);
    border-bottom: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    padding: 30px 0 30px 20px; /* Removed right padding for seamless links */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1000;
    transition: all 0.3s ease;
    gap: 0;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    margin-top: 40px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 8px 0 0 8px; /* Flat right edge */
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 0.9rem;
}

.sidebar-logout {
    padding-left: 0;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--bg-alt);
    color: var(--primary);
    border-left: 3px solid var(--accent);
    margin-right: -1px; /* Overlap sidebar border */
    padding-right: 0 !important;   /* Seamless right edge */
    position: relative;
    z-index: 2;
}

/* Hide mobile elements on desktop */
.volt-nav-overlay, .volt-header {
    display: none;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 280px; /* Offset for sidebar */
    padding: 60px 40px;
    width: auto;
    box-sizing: border-box;
    overflow-x: hidden;
    background-color: var(--bg-alt);
}

/* Volt Header (Mobile Mobile) */
.volt-header {
    display: none;
    /* Hidden on desktop */
}

/* Dashboard Cards */
.stat-card {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
    /* Webkit fix for grid items */
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* Responsive Grids */
.dashboard-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 450px), 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

/* Asymmetric Splits */
.dashboard-split-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-content {
    display: block;
    margin-bottom: 80px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile & Tablet Dashboard Responsive */
@media (max-width: 1100px) {
    .sidebar {
        display: none; /* Hide sidebar on small desktops / tablets / phones */
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 90px 20px 40px !important; /* Unified padding for space and balance */
    }

    .volt-header {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background: var(--bg-main);
        border-bottom: 1px solid var(--border);
        z-index: 1300;
        height: 70px; /* Consistently taller for better interaction */
    }

    .volt-header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 70px;
        padding: 0 20px;
        background: var(--bg-main);
    }

    .volt-hamburger {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-alt) !important;
        border: 1px solid var(--border) !important;
        border-radius: 50%;
        color: var(--text-main);
        font-size: 1.1rem;
        cursor: pointer;
        transition: var(--transition);
    }

    .volt-hamburger:active {
        transform: scale(0.9);
    }

    .volt-nav-overlay {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: var(--bg-main);
        z-index: 2100;
        transform: translateY(-100%);
        transition: transform 0.6s cubic-bezier(0.85, 0, 0.15, 1);
        visibility: hidden;
        padding: 0;
        overflow-y: auto;
    }

    .volt-nav-overlay.active {
        transform: translateY(0);
        visibility: visible;
    }

    .volt-overlay-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 25px;
        border-bottom: 1px solid var(--border);
        height: 80px;
        background: var(--bg-main);
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .volt-overlay-actions {
        display: flex;
        gap: 12px;
        align-items: center;
    }

    .volt-close-btn, .volt-nav-overlay .toggle-btn {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        border: 1px solid var(--border);
        background: var(--bg-alt);
        color: var(--text-main);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: var(--transition);
        font-size: 1rem;
    }

    .volt-close-btn:hover, .volt-nav-overlay .toggle-btn:hover {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }

    .volt-overlay-nav {
        padding: 40px 25px;
        flex: 1;
    }

    .volt-nav-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 25px;
    }

    .volt-nav-item {
        font-family: var(--font-nav);
        font-size: 1.5rem;
        font-weight: 600;
        color: var(--text-main);
        text-decoration: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: color 0.3s;
    }

    .volt-nav-item:hover, .volt-nav-item.active {
        color: var(--primary);
    }

    .volt-nav-item i {
        font-size: 0.8rem;
        opacity: 0.4;
        transition: transform 0.3s ease;
    }

    .volt-nav-item.open i {
        transform: rotate(180deg);
    }

    .volt-nav-sublist {
        list-style: none;
        padding: 0 0 0 20px;
        margin: 0;
        display: none; /* Hidden by default */
        flex-direction: column;
        gap: 15px;
        border-left: 1px solid var(--border);
        margin-left: 6px;
        margin-top: 15px;
    }

    .volt-nav-item.open + .volt-nav-sublist {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .volt-nav-subitem {
        font-size: 1rem;
        color: var(--text-muted);
        text-decoration: none;
        transition: var(--transition);
        font-weight: 500;
    }

    .volt-nav-subitem:hover {
        color: var(--primary);
        padding-left: 5px;
    }

    .dashboard-grid-2, .dashboard-grid-3, .dashboard-split-2-1 {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .stat-card {
        padding: 20px !important;
    }

    /* Dashboard Header Mobile Fix */
    .dashboard-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 20px !important;
        margin-bottom: 30px !important;
    }

    .header-profile {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        background: var(--bg-main) !important;
        padding: 15px !important;
        border-radius: var(--radius) !important;
        border: 1px solid var(--border) !important;
    }

    .profile-avatar {
        width: 60px !important;
        height: 60px !important;
        flex-shrink: 0 !important;
        object-fit: cover !important;
        border-radius: 50% !important;
    }

    /* Table Responsiveness Fix */
    .data-table-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 20px;
    }

    .data-table {
        min-width: 600px; /* Force scroll on small screens */
    }
}


.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    width: 100%;
    gap: 20px;
}

.header-title {
    flex: 1;
    min-width: 0;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.profile-info {
    text-align: right;
}

.profile-info h4 {
    font-size: 1.1rem;
    margin-bottom: 2px;
    color: var(--text-main);
    white-space: nowrap;
}

.profile-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .dashboard-header h1 {
        font-size: 1.5rem !important;
    }

    .profile-info h4 {
        font-size: 1rem;
    }

    .profile-avatar {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 85px 15px 20px !important;
    }

    .stat-card h3 {
        font-size: 1.15rem;
    }

    .volt-header-top .logo {
        font-size: 1.1rem;
    }

    /* Scale charts for small screens */
    .stat-card div[style*="height: 300px"], 
    .stat-card div[style*="height: 250px"] {
        height: 200px !important;
    }
}

/* Secondary Dashboard Components */
.stock-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: var(--bg-alt);
    border-radius: var(--radius);
}

.stock-item img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .stock-item {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: left;
    }

    .stock-item img {
        width: 100% !important;
        height: 180px !important; /* Slightly taller for better aspect ratio on mobile */
        margin-bottom: 5px;
    }

    .stock-item div {
        margin-bottom: 10px;
    }

    .stock-item button {
        width: 100%;
    }
}

@media (max-width: 992px) {
    .consult-banner {
        flex-direction: column !important;
        padding: 40px 25px !important;
        text-align: center !important;
        gap: 30px !important;
    }

    /* Target both sides of the banner to center on mobile */
    .consult-banner > div {
        text-align: center !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .consult-banner .btn-group,
    .consult-banner div[style*="display: flex"] {
        justify-content: center !important;
        gap: 15px !important;
        flex-wrap: wrap !important;
    }

    .footer {
        padding: 40px 20px !important;
        margin-top: 40px !important;
        background: #0f172a !important;
    }

    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 40px !important;
        text-align: left !important;
    }
}