/* KwikConnectHub - Buyer Dashboard Styles */

:root {
    --emerald: #059669;
    --emerald-light: #d1fae5;
    --emerald-dark: #065f46;
    --teal: #0d9488;
    --surface: #f8faf9;
    --white: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --radius: 14px;
    --radius-sm: 10px;
    --sidebar-w: 240px;
    --navbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-y: scroll; }
body { font-family: 'Inter', sans-serif; background: var(--surface); color: var(--text); margin: 0; }
::selection { background: var(--emerald-light); color: var(--emerald-dark); }
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── NAVBAR ── */
.navbar {
    position: fixed; top: 0; width: 100%;
    height: var(--navbar-h);
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    transition: box-shadow 0.3s;
}
.navbar.scrolled { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }

.nav-inner {
    max-width: 100%; padding: 0 1.5rem;
    height: 100%; display: flex; align-items: center; gap: 1rem;
}

.nav-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.nav-logo-mark {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--emerald), var(--teal));
    border-radius: 9px; display: flex; align-items: center;
    justify-content: center; color: white; font-weight: 800; font-size: 0.9rem;
}
.nav-logo-text {
    font-weight: 700; font-size: 1.1rem;
    background: linear-gradient(135deg, var(--emerald-dark), var(--teal));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.nav-spacer { flex: 1; }

.nav-right { display: flex; align-items: center; gap: 0.5rem; }

.nav-icon-btn {
    position: relative; width: 38px; height: 38px;
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; text-decoration: none;
}
.nav-icon-btn i { width: 20px; height: 20px; }
.nav-icon-btn:hover { background: var(--border-light); color: var(--text); }

.notif-dot {
    position: absolute; top: 7px; right: 7px;
    width: 8px; height: 8px; background: #ef4444;
    border-radius: 50%; border: 2px solid white;
}

.nav-avatar-wrap {
    position: relative; display: flex; align-items: center;
    gap: 8px; cursor: pointer; padding: 6px 10px;
    border-radius: var(--radius-sm); transition: background 0.2s;
}
.nav-avatar-wrap:hover { background: var(--border-light); }

.nav-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white; font-weight: 700; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.nav-avatar-name { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.nav-chevron { width: 14px; height: 14px; color: var(--text-muted); }

.avatar-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0;
    width: 200px; background: var(--white);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-md); z-index: 200; padding: 0.4rem;
    animation: dropIn 0.15s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 0.6rem 0.75rem; border-radius: 8px;
    font-size: 0.875rem; color: var(--text);
    text-decoration: none; transition: background 0.15s;
}
.dropdown-item i { width: 15px; height: 15px; color: var(--text-muted); }
.dropdown-item:hover { background: var(--border-light); }
.dropdown-item.danger { color: #ef4444; }
.dropdown-item.danger i { color: #ef4444; }
.dropdown-divider { height: 1px; background: var(--border); margin: 0.3rem 0; }

.nav-mobile-btn {
    display: none; background: none; border: none;
    cursor: pointer; color: var(--text); padding: 6px;
}
.nav-mobile-btn i { width: 22px; height: 22px; }

/* ── LAYOUT ── */
.app-layout {
    display: flex;
    margin-top: var(--navbar-h);
    min-height: calc(100vh - var(--navbar-h));
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--border);
    position: fixed;
    top: var(--navbar-h);
    left: 0;
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    z-index: 90;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.75rem;
    transition: transform 0.3s ease;
}

.sidebar-profile {
    display: flex; align-items: center; gap: 10px;
    padding: 0.75rem; margin-bottom: 1rem;
    background: var(--surface); border-radius: var(--radius-sm);
}

.sidebar-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white; font-weight: 700; font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.sidebar-name { font-size: 0.875rem; font-weight: 700; color: var(--text); }
.sidebar-role { font-size: 0.72rem; color: #3b82f6; font-weight: 600; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 0.65rem 0.85rem; border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 500;
    color: var(--text-muted); text-decoration: none;
    transition: all 0.15s; cursor: pointer;
    border: none; background: none; width: 100%; text-align: left;
    font-family: 'Inter', sans-serif;
}
.sidebar-link i { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--surface); color: var(--text); }
.sidebar-link.active { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.sidebar-link.active i { color: #3b82f6; }
.sidebar-link.danger { color: #ef4444; }
.sidebar-link.danger:hover { background: #fef2f2; }

.nav-badge {
    margin-left: auto; min-width: 20px; height: 20px;
    background: #ef4444; color: white;
    border-radius: 50px; font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.sidebar-divider { height: 1px; background: var(--border); margin: 0.5rem 0; }

.sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 89; backdrop-filter: blur(2px);
}

/* ── MAIN ── */
.dash-main {
    margin-left: var(--sidebar-w);
    flex: 1; padding: 2rem; min-width: 0;
}

/* ── SECTIONS ── */
.dash-section { display: none; }
.dash-section.active { display: block; animation: fadeUp 0.3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-header {
    display: flex; align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem;
}
.page-title { font-size: 1.6rem; font-weight: 800; color: var(--text); letter-spacing: -0.4px; margin: 0 0 0.25rem; }
.page-subtitle { font-size: 0.9rem; color: var(--text-muted); margin: 0; }

/* ── STATS ── */
.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 1rem; margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
    box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon i { width: 22px; height: 22px; }
.stat-icon.emerald { background: var(--emerald-light); color: var(--emerald); }
.stat-icon.blue    { background: #dbeafe; color: #3b82f6; }
.stat-icon.purple  { background: #ede9fe; color: #7c3aed; }
.stat-icon.amber   { background: #fef3c7; color: #d97706; }

.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.stat-val   { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }

/* ── CARDS ── */
.dash-card {
    background: var(--white); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 1.5rem;
    box-shadow: var(--shadow-sm); margin-bottom: 1.5rem;
}

.dash-card-header {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 1.25rem;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

.dash-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.dash-table th {
    text-align: left; padding: 0.65rem 0.85rem;
    font-size: 0.75rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
    white-space: nowrap; background: var(--surface);
}

.dash-table td {
    padding: 0.85rem 0.85rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text); vertical-align: middle;
}
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: var(--surface); }

/* Status badges */
.status-badge {
    display: inline-flex; align-items: center;
    padding: 0.2rem 0.65rem; border-radius: 50px;
    font-size: 0.72rem; font-weight: 600;
}
.status-badge.pending   { background: #fef3c7; color: #92400e; }
.status-badge.active    { background: var(--emerald-light); color: var(--emerald-dark); }
.status-badge.completed { background: #dbeafe; color: #1e40af; }
.status-badge.cancelled { background: #fee2e2; color: #991b1b; }

/* Empty table */
.empty-table {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.5rem; padding: 2.5rem; color: var(--text-muted); font-size: 0.875rem;
}
.empty-table i { width: 36px; height: 36px; opacity: 0.4; }
.empty-table a { color: var(--emerald); text-decoration: none; font-weight: 500; }
.empty-table a:hover { text-decoration: underline; }

/* ── SAVED GRID ── */
.saved-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}

.saved-card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    cursor: pointer; transition: all 0.25s;
}
.saved-card:hover { box-shadow: var(--shadow-md); border-color: #d1fae5; transform: translateY(-2px); }

.saved-card-img { height: 130px; background: var(--border-light); overflow: hidden; }
.saved-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.saved-card:hover .saved-card-img img { transform: scale(1.05); }

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

.saved-card-title {
    font-size: 0.85rem; font-weight: 600; color: var(--text);
    margin-bottom: 0.5rem; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    line-height: 1.4;
}

.saved-card-meta {
    display: flex; align-items: center; justify-content: space-between;
}

.saved-rating {
    display: flex; align-items: center; gap: 3px;
    font-size: 0.78rem; color: var(--text-muted);
}
.saved-rating i { width: 12px; height: 12px; color: #f59e0b; fill: #f59e0b; }

.saved-price { font-size: 0.9rem; font-weight: 700; color: var(--text); }

/* ── REVIEWS ── */
.reviews-list { display: flex; flex-direction: column; gap: 1rem; }

.review-item {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.review-item-header {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 0.5rem;
}

.review-service { font-size: 0.85rem; font-weight: 600; color: var(--emerald); }
.review-date    { font-size: 0.75rem; color: var(--text-muted); }

.review-stars { display: flex; gap: 2px; margin-bottom: 0.5rem; }
.review-stars i { width: 13px; height: 13px; color: #f59e0b; fill: #f59e0b; }

.review-text { font-size: 0.875rem; line-height: 1.7; color: #374151; }

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center; padding: 4rem 2rem;
    display: flex; flex-direction: column;
    align-items: center; gap: 0.75rem;
}
.empty-state i { width: 48px; height: 48px; color: #d1d5db; }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin: 0; }
.empty-state p  { font-size: 0.875rem; color: var(--text-muted); margin: 0; }

/* ── BUTTONS ── */
.btn-primary {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0.6rem 1.25rem;
    background: linear-gradient(135deg, var(--emerald), var(--teal));
    color: white; border: none; border-radius: 50px;
    font-family: 'Inter', sans-serif; font-size: 0.875rem;
    font-weight: 600; cursor: pointer; text-decoration: none; transition: all 0.2s;
}
.btn-primary i { width: 16px; height: 16px; }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(5,150,105,0.35); transform: translateY(-1px); }

.btn-ghost {
    background: none; border: none; font-family: 'Inter', sans-serif;
    font-size: 0.8rem; font-weight: 500; color: var(--emerald);
    cursor: pointer; padding: 0.35rem 0.65rem; border-radius: 8px;
    transition: background 0.15s; text-decoration: none;
}
.btn-ghost:hover { background: var(--emerald-light); }

.select-sm {
    padding: 0.45rem 0.75rem; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-family: 'Inter', sans-serif;
    font-size: 0.8rem; color: var(--text); background: var(--white);
    outline: none; cursor: pointer;
}
.select-sm:focus { border-color: var(--emerald); }

/* ── TOAST ── */
.toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    background: #111827; color: white;
    padding: 0.85rem 1.25rem; border-radius: 12px;
    font-size: 0.875rem; display: flex; align-items: center;
    gap: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 300; transform: translateY(20px); opacity: 0;
    transition: all 0.3s ease;
}
.toast i { width: 16px; height: 16px; color: #6ee7b7; }
.toast.show { transform: translateY(0); opacity: 1; }

/* ── UTILITY ── */
.hidden { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .saved-grid  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); z-index: 150; }
    .sidebar.open { transform: translateX(0); }
    .dash-main { margin-left: 0; padding: 1.25rem; }
    .nav-mobile-btn { display: flex; }
    .nav-avatar-name { display: none; }
}

@media (max-width: 600px) {
    .stats-grid  { grid-template-columns: 1fr 1fr; }
    .saved-grid  { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .page-title { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
    .stat-card:hover, .saved-card:hover { transform: none; }
    .dash-section.active { animation: none; }
}
