﻿/* Dashboard Premium Styles - AdminLTE compatible, no layout overrides */

/* Optional per-page class to hide topbar without touching sidebar */
body.dp-no-topbar .main-header {
    display: none !important;
}

body.dp-no-topbar .content-wrapper {
    margin-top: 0 !important;
}

/* Make page area fill width; when sidebar is collapsed, content wrapper is already full width by AdminLTE. Ensure our wrapper stretches. */
.dashboard-premium-wrapper {
    width: 100%;
    min-height: calc(100vh - 120px);
    padding: 1.5rem;
    margin: 0;
    position: relative;
    overflow-x: hidden;
}

/* When sidebar is collapsed, ensure inner container expands fully */
body.sidebar-collapse .dashboard-premium-wrapper {
    width: 100%;
}

/* Font Awesome icon normalization in dashboard scope */
.dashboard-premium i,
.dashboard-premium .fas,
.dashboard-premium .far,
.dashboard-premium .fab {
    font-family: "Font Awesome 5 Free", "Font Awesome 6 Free", "Font Awesome 5 Brands", "Font Awesome 6 Brands", Arial, sans-serif !important;
    font-weight: 900;
}

.dashboard-premium .far {
    font-weight: 400;
}

/* Page Header */
.dashboard-premium .page-header {
    background: white;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

.dashboard-premium .page-title {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

    .dashboard-premium .page-title i {
        background: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary-dark) 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

.dashboard-premium .current-period {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    background: var(--theme-primary-subtle);
    border-radius: 8px;
    font-weight: 600;
    color: var(--theme-primary-dark);
    font-size: .875rem;
}

/* Menu Toggle Button */
.dashboard-menu-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary-dark) 100%);
    border: none;
    outline: none;
    color: #fff !important;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px var(--theme-shadow);
    cursor: pointer;
}

    .dashboard-menu-btn i {
        color: #fff !important;
    }

/* Time Filter */
.dashboard-premium .time-filter-container {
    display: flex;
    gap: .625rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.dashboard-premium .time-filter-btn {
    background: #fff;
    border: 2px solid #e9ecef;
    color: #495057;
    padding: .5rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    transition: all .3s;
}

    .dashboard-premium .time-filter-btn.active {
        background: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary-dark) 100%);
        color: #fff;
    }

/* KPI Cards */
.dashboard-premium .kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.dashboard-premium .kpi-card {
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    position: relative;
    overflow: hidden;
    min-height: 180px;
}

.dashboard-premium .kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 1rem;
}

    .dashboard-premium .kpi-icon.primary {
        background: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary-dark) 100%);
    }

    .dashboard-premium .kpi-icon.info {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    }

    .dashboard-premium .kpi-icon.success {
        background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    }

    .dashboard-premium .kpi-icon.warning {
        background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    }

.dashboard-premium .kpi-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -1px;
    min-height: 2.5rem;
}

/* Sections */
.dashboard-premium .data-section {
    background: #fff;
    border-radius: 14px;
    padding: 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    overflow: hidden;
}

.dashboard-premium .data-section-header {
    background: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary-dark) 100%);
    color: #fff;
    padding: 1.25rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .dashboard-premium .data-section-header.blue {
        background: linear-gradient(135deg, var(--theme-primary-light) 0%, var(--theme-primary-dark) 100%);
    }

    .dashboard-premium .data-section-header.pink {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    }

    .dashboard-premium .data-section-header.orange {
        background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
        color: #1a1a1a;
    }

.dashboard-premium .data-section-title {
    font-weight: 700;
    margin: 0;
    display: flex;
    gap: .65rem;
    align-items: center;
}

    .dashboard-premium .data-section-title i {
        color: inherit;
    }

.dashboard-premium .data-section-body {
    padding: 1.75rem;
}

/* Tables */
.dashboard-premium .modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

    .dashboard-premium .modern-table thead th {
        background: #f8f9fa;
        color: #495057;
        font-weight: 700;
        font-size: .75rem;
        text-transform: uppercase;
        padding: .875rem .65rem;
        border-bottom: 2px solid #dee2e6;
    }

    .dashboard-premium .modern-table tbody tr:hover {
        background: rgba(102,126,234,.05);
    }

    .dashboard-premium .modern-table tbody td {
        padding: .875rem .65rem;
        border-bottom: 1px solid #f0f0f0;
        font-size: .85rem;
    }

.dashboard-premium .text-end {
    text-align: right;
}

/* Charts */
.dashboard-premium .chart-container {
    position: relative;
    height: 280px;
    margin-top: 1rem;
}

    .dashboard-premium .chart-container.large {
        height: 380px;
    }

/* --- Top Products (fix layout/overflow/alignment) --- */
.dashboard-premium .product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem .75rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color .15s ease, box-shadow .15s ease;
    border-radius: 10px;
}

    .dashboard-premium .product-item:hover {
        background: rgba(102,126,234,.05);
        box-shadow: 0 2px 8px rgba(0,0,0,.05);
    }

    .dashboard-premium .product-item:last-child {
        border-bottom: 0;
    }

.dashboard-premium .product-info {
    flex: 1 1 auto;
    min-width: 0;
}

/* Allow 2-line clamp for long names instead of single-line cut */
.dashboard-premium .product-name {
    font-weight: 600;
    color: #1a1a1a;
    font-size: .95rem;
    margin-bottom: .2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    line-height: 1.2;
}

.dashboard-premium .product-meta {
    font-size: .78rem;
    color: #6c757d;
}

.dashboard-premium .product-stats {
    text-align: right;
    flex: 0 0 auto;
    min-width: 120px;
}

.dashboard-premium .product-value {
    font-weight: 700;
    font-size: .95rem;
    color: #1a1a1a;
    white-space: nowrap;
}

.dashboard-premium .product-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 12px;
    font-size: .7rem;
    font-weight: 600;
    margin-top: .25rem;
}

    .dashboard-premium .product-badge.hot {
        background: rgba(239,68,68,.1);
        color: #ef4444;
    }

    .dashboard-premium .product-badge.trending {
        background: rgba(245,158,11,.12);
        color: #d97706;
    }

@media (max-width: 576px) {
    .dashboard-premium .product-stats {
        min-width: 90px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-premium-wrapper {
        padding: 1rem;
    }

    .dashboard-premium .kpi-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-premium .chart-container {
        height: 220px;
    }

        .dashboard-premium .chart-container.large {
            height: 280px;
        }
}

/* Sidebar text wrapping fix when sidebar is expanded on premium page */
body.dp-premium-page .main-sidebar .nav-sidebar .nav-link {
    white-space: nowrap;
}

    body.dp-premium-page .main-sidebar .nav-sidebar .nav-link p,
    body.dp-premium-page .main-sidebar .nav-sidebar .nav-treeview .nav-link {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

body.dp-premium-page .main-sidebar .brand-link .brand-text,
body.dp-premium-page .main-sidebar .user-panel .info {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
