﻿/* =================================================================
   DASHBOARD - Professional Business Theme
   Color Palette: Trust Blue · Success Green · Warning Amber · Danger Red
   ================================================================= */

:root {
    --clr-primary:      #2563eb;
    --clr-primary-dark: #1d4ed8;
    --clr-primary-900:  #1e3a8a;
    --clr-primary-50:   #eff6ff;
    --clr-primary-100:  #dbeafe;

    --clr-success:      #059669;
    --clr-success-dark: #047857;
    --clr-success-50:   #ecfdf5;

    --clr-warning:      #d97706;
    --clr-warning-dark: #b45309;
    --clr-warning-50:   #fffbeb;

    --clr-danger:       #dc2626;
    --clr-danger-dark:  #b91c1c;
    --clr-danger-50:    #fef2f2;

    --clr-purple:       #7c3aed;
    --clr-purple-dark:  #6d28d9;
    --clr-purple-50:    #f5f3ff;

    --clr-teal:         #0891b2;
    --clr-teal-dark:    #0e7490;
    --clr-teal-50:      #ecfeff;

    --clr-gray-50:  #f9fafb;
    --clr-gray-100: #f3f4f6;
    --clr-gray-200: #e5e7eb;
    --clr-gray-400: #9ca3af;
    --clr-gray-500: #6b7280;
    --clr-gray-700: #374151;
    --clr-gray-900: #111827;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:    0 4px 10px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 20px rgba(0,0,0,0.09), 0 3px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 15px 35px rgba(0,0,0,0.1),  0 5px 15px rgba(0,0,0,0.06);

    --radius:    12px;
    --radius-sm:  8px;
    --radius-lg: 16px;
}

/* ==============================================================
   DASHBOARD HEADER (Separate, Prominent)
   ============================================================== */
.dash-header {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 60%, #1e3a8a 100%);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 30px rgba(29, 78, 216, 0.28);
    position: relative;
    overflow: hidden;
}

.dash-header::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 130px; height: 130px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
    pointer-events: none;
}
.dash-header::after {
    content: '';
    position: absolute;
    bottom: -25px; right: 100px;
    width: 90px; height: 90px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    pointer-events: none;
}

.dash-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.dash-header-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
}

.dash-title {
    color: white !important;
    font-size: 1.55rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    line-height: 1.2;
    -webkit-text-fill-color: white !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
}

.dash-title::after { display: none !important; }

.dash-subtitle {
    color: rgba(255,255,255,0.78);
    font-size: 0.82rem;
    margin: 3px 0 0;
    line-height: 1.4;
}

.dash-header-right {
    position: relative; z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.dash-date-pill {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50px;
    padding: 7px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

.dash-date-pill i { font-size: 13px; opacity: 0.85; }

/* ==============================================================
   BILLING ALERT
   ============================================================== */
.billing-alert-banner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fcd34d;
    border-left: 4px solid #d97706;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    box-shadow: 0 3px 10px rgba(217,119,6,0.12);
    animation: slideDown 0.3s ease-out;
}

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

.billing-alert-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.billing-alert-icon { font-size: 16px; color: #d97706; flex-shrink: 0; }

.billing-alert-text {
    font-size: 0.83rem;
    font-weight: 500;
    color: #78350f;
    margin: 0;
    line-height: 1.5;
}

.billing-alert-text strong { font-weight: 700; }

.billing-dismiss-btn {
    background: rgba(146,64,14,0.1);
    border: none;
    color: #92400e;
    width: 26px; height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 12px;
    transition: background 0.2s;
    font-size: 12px;
}

.billing-dismiss-btn:hover { background: rgba(146,64,14,0.2); }

/* ==============================================================
   SECTION HEADERS (.dbhr)
   ============================================================== */
.dbhr {
    background: white;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    margin: 16px 0 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--clr-primary);
    border-top: 1px solid var(--clr-gray-100);
    border-bottom: 1px solid var(--clr-gray-100);
    border-right: 1px solid var(--clr-gray-100);
}

.dbhr h4 {
    color: var(--clr-primary-900) !important;
    margin: 0 !important;
    font-weight: 700;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.dbhr h4 i { color: var(--clr-primary); font-size: 14px; }

.dbhr:nth-of-type(2) { border-left-color: var(--clr-success); }
.dbhr:nth-of-type(2) h4 { color: var(--clr-success-dark) !important; }
.dbhr:nth-of-type(2) h4 i { color: var(--clr-success); }

.dbhr span { display: none; }

/* ==============================================================
   STAT CARDS
   ============================================================== */
.card {
    border: 1px solid var(--clr-gray-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
    background: white;
}

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

.card-body { padding: 0.85rem 1rem !important; }

.d-icons {
    width: 46px; height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-dark));
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.d-content h6 {
    color: var(--clr-gray-500);
    font-weight: 500;
    font-size: 0.71rem;
    margin-bottom: 2px !important;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.d-content .h3 {
    color: var(--clr-gray-900);
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1.2;
}

/* Semantic 4-color rotation */
.card:nth-child(4n+1) .d-icons { background: linear-gradient(135deg, #2563eb, #1d4ed8) !important; box-shadow: 0 4px 12px rgba(37,99,235,0.28) !important; }
.card:nth-child(4n+2) .d-icons { background: linear-gradient(135deg, #059669, #047857) !important; box-shadow: 0 4px 12px rgba(5,150,105,0.28) !important; }
.card:nth-child(4n+3) .d-icons { background: linear-gradient(135deg, #d97706, #b45309) !important; box-shadow: 0 4px 12px rgba(217,119,6,0.28) !important; }
.card:nth-child(4n+4) .d-icons { background: linear-gradient(135deg, #dc2626, #b91c1c) !important; box-shadow: 0 4px 12px rgba(220,38,38,0.28) !important; }

/* Subtle colored left border */
.card:nth-child(4n+1) { border-left: 3px solid #2563eb; }
.card:nth-child(4n+2) { border-left: 3px solid #059669; }
.card:nth-child(4n+3) { border-left: 3px solid #d97706; }
.card:nth-child(4n+4) { border-left: 3px solid #dc2626; }

/* ==============================================================
   CHART / FULL-HEIGHT CARDS
   ============================================================== */
.card-fullheight {
    background: white;
    border: 1px solid var(--clr-gray-100);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    overflow: hidden;
    border-top: none;
}

.card-fullheight::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #0891b2, #059669);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-fullheight .card-body { padding: 18px 20px !important; }

.box-title {
    color: var(--clr-gray-900);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--clr-gray-100);
    background: none !important;
    -webkit-text-fill-color: var(--clr-gray-900) !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
}

/* ==============================================================
   PRODUCT LIST (Best Sellers)
   ============================================================== */
.media-list-divider .media {
    padding: 10px 8px;
    border-bottom: 1px solid var(--clr-gray-100);
    transition: background 0.2s, padding-left 0.2s;
    border-radius: 6px;
}

.media-list-divider .media:hover {
    background: var(--clr-primary-50);
    padding-left: 14px;
}

.media-list-divider .media:last-child { border-bottom: none; }

.hover-link {
    color: var(--clr-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.93rem;
    background: none !important;
    -webkit-text-fill-color: var(--clr-primary) !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
}

.hover-link:hover {
    color: var(--clr-primary-dark);
    -webkit-text-fill-color: var(--clr-primary-dark) !important;
    text-decoration: underline;
}

/* ==============================================================
   BADGE POINTS
   ============================================================== */
.badge-point {
    width: 12px; height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

.badge-primary { background: var(--clr-primary); }
.badge-danger  { background: var(--clr-danger); }
.badge-warning { background: var(--clr-warning); }

/* ==============================================================
   TABLE
   ============================================================== */
.table { border-radius: var(--radius-sm); overflow: hidden; }

.table thead th {
    background: var(--clr-primary);
    border-bottom: none;
    color: white;
    font-weight: 600;
    font-size: 0.83rem;
    letter-spacing: 0.3px;
    padding: 10px 12px;
}

.table thead th::after { display: none; }

.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--clr-primary-50); }

#low-stock-data thead th {
    background: var(--clr-gray-100) !important;
    color: var(--clr-gray-700) !important;
    border-bottom: 1px solid var(--clr-gray-200) !important;
}
#low-stock-data tbody tr:hover { background: var(--clr-gray-50) !important; }
#low-stock-data { box-shadow: var(--shadow-sm) !important; }

/* ==============================================================
   PAGE TITLE (legacy compatibility)
   ============================================================== */
.page-title {
    color: var(--clr-primary-900) !important;
    font-weight: 700;
    font-size: 1.55rem !important;
    -webkit-text-fill-color: var(--clr-primary-900) !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
}

.page-title::after { display: none; }

/* ==============================================================
   RESPONSIVE
   ============================================================== */

/* Mobile – up to 575px */
@media (max-width: 575.98px) {
    .dash-header { flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 16px; }
    .dash-header-right { align-items: flex-start; }
    .dash-title { font-size: 1.25rem !important; }
    .dash-subtitle { font-size: 0.77rem; }
    .dash-header-icon { width: 42px; height: 42px; font-size: 18px; }
    .d-content .h3 { font-size: 1rem; }
    .d-content h6 { font-size: 0.68rem; }
    .d-icons { width: 38px; height: 38px; font-size: 15px; margin-right: 9px; }
    .card-body { padding: 0.7rem 0.8rem !important; }
    .card { margin-bottom: 8px; }
    .dbhr { padding: 8px 12px; margin: 12px 0 8px 0; }
    .dbhr h4 { font-size: 0.82rem; }
    .card-fullheight .card-body { padding: 14px !important; }
    .box-title { font-size: 0.9rem; }
}

/* Large phones / Small tablets – 576-767px */
@media (min-width: 576px) and (max-width: 767.98px) {
    .dash-header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 18px; }
    .dash-title { font-size: 1.35rem !important; }
    .d-content .h3 { font-size: 1.05rem; }
    .d-icons { width: 42px; height: 42px; font-size: 16px; }
    .card-body { padding: 0.8rem 0.9rem !important; }
}

/* Tablets – 768-991px */
@media (min-width: 768px) and (max-width: 991.98px) {
    .dash-title { font-size: 1.4rem !important; }
    .d-content .h3 { font-size: 1.1rem; }
    .d-icons { width: 44px; height: 44px; font-size: 17px; }
}

/* Small laptops – 992-1199px */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .d-content .h3 { font-size: 1.1rem; }
    .d-icons { width: 44px; height: 44px; }
}

/* Large desktops – 1200px+ */
@media (min-width: 1200px) {
    .d-content .h3 { font-size: 1.25rem; }
    .d-icons { width: 48px; height: 48px; font-size: 19px; }
    .card-body { padding: 0.95rem 1.1rem !important; }
}

/* Ultra-wide – 1400px+ */
@media (min-width: 1400px) {
    .d-content .h3 { font-size: 1.3rem; }
    .d-icons { width: 50px; height: 50px; font-size: 20px; }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .dash-header { padding: 10px 16px; margin-bottom: 10px; }
    .dbhr { margin: 8px 0 6px 0; padding: 7px 12px; }
    .card { margin-bottom: 8px; }
    .card-body { padding: 0.6rem 0.8rem !important; }
}

/* High-DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card { box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
    .card:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.1); }
}
