﻿/* ================================================================
   Home.razor.css  —  Supermarket Dashboard
   ================================================================ */

/* ── Reset / Base ─────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ── Layout Shell ─────────────────────────────────────────────── */
.dashboard-layout {
    display: flex;
    direction: rtl;
    min-height: 100vh;
    background: #f0f2f7;
    font-family: "Times New Roman", Times, serif;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 72px;
    height: 100vh;
    background: #1a1f2e;
    display: flex;
    flex-direction: column;
    z-index: 200;
    border-left: 1px solid rgba(255,255,255,0.06);
    transition: width 0.28s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}

    .sidebar:hover {
        width: 220px;
    }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
    overflow: hidden;
    cursor: default;
}

.logo-icon {
    font-size: 26px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    opacity: 0;
    transition: opacity 0.18s;
    letter-spacing: 0.4px;
}

.sidebar:hover .logo-text {
    opacity: 1;
}

/* Nav items */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding-top: 8px;
}

.sidebar-footer {
    padding-bottom: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.18s;
    position: relative;
    text-decoration: none;
    color: rgba(255,255,255,0.78);
}

    .nav-item:hover {
        background: rgba(255,255,255,0.07);
    }

    .nav-item.active {
        background: #2563eb;
        color: #fff;
    }

        .nav-item.active::before {
            content: '';
            position: absolute;
            right: 0;
            top: 0;
            width: 3px;
            height: 100%;
            background: #93c5fd;
            border-radius: 0 3px 3px 0;
        }

.nav-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.nav-label {
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.18s;
}

.sidebar:hover .nav-label {
    opacity: 1;
}

/* ── Main Area ────────────────────────────────────────────────── */
.main-area {
    flex: 1;
    margin-right: 72px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-right 0.28s;
}

/* ── Top Bar ──────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 14px;
    border-bottom: 1px solid #e5e7eb;
}

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    flex: 1;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f4f5f7;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 14px;
    width: 240px;
}

    .topbar-search input {
        border: none;
        background: transparent;
        outline: none;
        font-size: 13px;
        width: 100%;
        direction: rtl;
        color: #374151;
    }

        .topbar-search input::placeholder {
            color: #9ca3af;
        }

.topbar-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f4f5f7;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    position: relative;
}

.badge-dot {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
}

/* ── Content ──────────────────────────────────────────────────── */
.content {
    padding: 24px;
}

/* ── Period Filter Bar ────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.filter-btn {
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    transition: all 0.15s;
}

    .filter-btn:hover {
        border-color: #2563eb;
        color: #2563eb;
    }

    .filter-btn.active {
        background: #2563eb;
        border-color: #2563eb;
        color: #fff;
    }

/* ── Stats Grid ───────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

    .stat-card:hover {
        box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    }

    .stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 4px;
        height: 100%;
        border-radius: 0 12px 12px 0;
    }

    .stat-card.blue::before {
        background: #2563eb;
    }

    .stat-card.green::before {
        background: #16a34a;
    }

    .stat-card.amber::before {
        background: #d97706;
    }

    .stat-card.rose::before {
        background: #e11d48;
    }

.stat-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #111827;
    line-height: 1;
    margin-bottom: 10px;
}

.stat-unit {
    font-size: 16px;
    font-weight: 600;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-block;
}

    .stat-change.up {
        background: #dcfce7;
        color: #16a34a;
    }

    .stat-change.down {
        background: #fee2e2;
        color: #dc2626;
    }

.stat-bg-icon {
    position: absolute;
    left: 14px;
    top: 14px;
    font-size: 32px;
    opacity: 0.1;
    pointer-events: none;
}

/* ── Quick Actions ────────────────────────────────────────────── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.qa-btn {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

    .qa-btn:hover {
        border-color: #2563eb;
        background: #eff6ff;
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(37,99,235,0.12);
    }

.qa-icon {
    font-size: 28px;
}

.qa-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-align: center;
}

/* ── Two-Column Grid ─────────────────────────────────────────── */
.grid-2col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

/* ── Card ─────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #f3f4f6;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.card-link {
    font-size: 12px;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
}

    .card-link:hover {
        text-decoration: underline;
    }

.card-body {
}

.table-wrap {
    overflow-x: auto;
}

/* ── Table ────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f9fafb;
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 10px 16px;
    text-align: right;
    border-bottom: 1px solid #f3f4f6;
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px solid #f9fafb;
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f9fafb;
}

td.amount {
    font-weight: 700;
    color: #111827;
}

/* Status Badges */
.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
    white-space: nowrap;
}

.s-done {
    background: #dcfce7;
    color: #15803d;
}

.s-processing {
    background: #dbeafe;
    color: #1d4ed8;
}

.s-new {
    background: #fef9c3;
    color: #854d0e;
}

.s-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

.s-default {
    background: #f3f4f6;
    color: #6b7280;
}

/* ── Alerts ───────────────────────────────────────────────────── */
.alert-list {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.alert-info {
    flex: 1;
}

.alert-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.alert-sub {
    font-size: 11px;
    color: #6b7280;
    margin-top: 1px;
}

.alert-qty {
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #fde68a;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #fde68a;
}

/* ── Weekly Chart ─────────────────────────────────────────────── */
.chart-wrap {
    padding: 14px 16px 10px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 80px;
    margin-bottom: 6px;
}

.chart-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 4px;
}

.chart-bar {
    width: 100%;
    background: #dbeafe;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: background 0.18s;
    min-height: 4px;
}

    .chart-bar:hover {
        background: #93c5fd;
    }

    .chart-bar.active {
        background: #2563eb;
    }

.chart-day-label {
    font-size: 10px;
    color: #9ca3af;
    text-align: center;
}

/* ── Top Products Grid ────────────────────────────────────────── */
.top-products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.top-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}

    .top-item:hover {
        background: #f9fafb;
    }

    .top-item:nth-child(odd) {
        border-left: 1px solid #f3f4f6;
    }

    .top-item:nth-last-child(-n+2) {
        border-bottom: none;
    }

.rank-badge {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}

.rank-1 {
    background: #fef9c3;
    color: #854d0e;
}

.rank-2 {
    background: #f1f5f9;
    color: #475569;
}

.rank-3 {
    background: #fff7ed;
    color: #9a3412;
}

.rank-n {
    background: #f3f4f6;
    color: #6b7280;
}

.top-details {
    flex: 1;
    min-width: 0;
}

.top-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-sub {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 5px;
}

.progress-bar {
    background: #e5e7eb;
    border-radius: 4px;
    height: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.fill-blue {
    background: #2563eb;
}

.fill-purple {
    background: #7c3aed;
}

.fill-green {
    background: #16a34a;
}

.fill-amber {
    background: #d97706;
}

.top-revenue {
    font-size: 13px;
    font-weight: 700;
    color: #2563eb;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Login Screen ─────────────────────────────────────────────── */
.login-screen {
    min-height: 100vh;
    background: #f0f2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    padding: 40px 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

.login-icon-wrap {
    width: 72px;
    height: 72px;
    background: #eff6ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.login-title {
    font-size: 22px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 28px;
    line-height: 1.6;
}

.login-btn {
    display: block;
    background: #2563eb;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 13px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.18s;
}

    .login-btn:hover {
        background: #1d4ed8;
    }

/* ── Footer ───────────────────────────────────────────────────── */
.app-footer {
    background: #1a1f2e;
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 14px;
    font-size: 12px;
    margin-right: 72px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-2col {
        grid-template-columns: 1fr;
    }

    .top-products-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .content {
        padding: 16px;
    }

    .topbar-search {
        display: none;
    }
}
