@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Sans+Arabic:wght@300;400;500;600;700&display=swap');

/* ================================================================
   DEALAK — B2B Marketplace Design System
   Font: Plus Jakarta Sans | Palette: Navy + Blue CTA
   ================================================================ */

:root {
    --primary: #0369a1;
    --primary-hover: #0284c7;
    --primary-light: #e0f2fe;
    --secondary: #64748b;
    --accent: #f43f5e;
    --accent-light: #fff1f2;
    --dark: #0f172a;
    --light: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.1);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
    background: var(--light);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text-primary) !important;
    -webkit-font-smoothing: antialiased;
}

/* ---- Navbar ---- */
.navbar {
    background: var(--dark) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    padding: 0.75rem 0;
    transition: all var(--transition);
}
.navbar-brand {
    font-weight: 800;
    letter-spacing: -0.5px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0;
}
.brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    box-shadow: 0 2px 6px rgba(197, 164, 78, 0.25), inset 0 0 0 1px rgba(197, 164, 78, 0.4);
    padding: 4px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.navbar-brand:hover .brand-logo-wrap {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(197, 164, 78, 0.4), inset 0 0 0 1px rgba(197, 164, 78, 0.6);
}
.brand-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.brand-name {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #c5a44e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}
.navbar .nav-link {
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px;
    transition: background var(--transition);
}
.navbar .nav-link:hover {
    background: rgba(255,255,255,0.08);
}

/* ---- Cards ---- */
.card, .login-card, .filter-form {
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover {
    box-shadow: var(--shadow);
}
.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    padding: 1rem 1.25rem;
}

/* ---- Stat Cards ---- */
.stat-card {
    border: none !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 0 0 0 100%;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}
.stat-card .card-body { padding: 1.75rem; position: relative; z-index: 1; }
.stat-card .stat-icon { font-size: 2.5rem; opacity: 0.9; }
.stat-card .stat-value { font-size: 2.2rem; font-weight: 800; line-height: 1.1; }

/* ---- Buttons ---- */
.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    transition: all var(--transition);
    font-size: 0.9rem;
    cursor: pointer;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(3, 105, 161, 0.25);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(3, 105, 161, 0.35);
}
.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}
.btn-danger {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25);
}
.btn-danger:hover {
    background: #e11d48;
    border-color: #e11d48;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.35);
}

/* ---- Item Cards (Public) ---- */
.item-card {
    height: 100%;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    cursor: pointer;
}
.item-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
}
.item-card .card-img-top {
    height: 240px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
    transition: transform 0.4s ease;
}
.item-card:hover .card-img-top { transform: scale(1.04); }
.item-card .card-body {
    padding: 1.25rem;
    position: relative;
    z-index: 10;
    background: var(--surface);
}
.item-card .card-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
    color: var(--text-primary);
}
.item-card .price-tag {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.item-card .original-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-right: 6px;
    font-weight: 500;
}
.item-card .supplier-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--light);
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
}

/* ---- Group Headers ---- */
.group-header {
    border-left: none;
    padding-left: 0;
    margin: 2.5rem 0 1.25rem;
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}
.group-header::before {
    content: '';
    width: 5px;
    height: 22px;
    background: var(--primary);
    margin-right: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ---- Forms ---- */
.form-control, .form-select {
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    padding: 0.65rem 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition);
    background: var(--surface);
    color: var(--text-primary);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.12);
    background: var(--surface);
}
.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

/* ---- Tables ---- */
.table { background: transparent; }
.table th {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    padding: 1rem;
    white-space: nowrap;
}
.table td {
    padding: 1rem;
    vertical-align: middle;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.table-hover tbody tr {
    transition: background var(--transition);
}
.table-hover tbody tr:hover {
    background-color: var(--light);
}

/* ---- Badges ---- */
.badge {
    padding: 0.4em 0.75em;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.2px;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-done { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* ---- Login ---- */
.login-container { max-width: 420px; margin: 80px auto; }
.login-card { padding: 2rem; border-radius: var(--radius-xl); }

/* ---- Misc ---- */
.img-preview {
    max-width: 200px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 3px solid var(--surface);
}
.no-image {
    width: 100%;
    height: 240px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 3.5rem;
    transition: transform 0.4s ease;
}

/* ---- Filter pills ---- */
.filter-form {
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.filter-form .form-label { font-size: 0.8rem; }

/* ---- Footer ---- */
footer { border-top: 1px solid var(--border); }

.site-footer {
    background: linear-gradient(135deg, #0a0e1a 0%, #16213e 100%);
    color: #cbd5e1;
    padding: 40px 0 20px;
    position: relative;
}
.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #c5a44e 30%, #c5a44e 70%, transparent 100%);
}
.site-footer .footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.site-footer .footer-left {
    flex: 1;
    min-width: 240px;
}
.site-footer .footer-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.site-footer .footer-tagline {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
}
.site-footer .footer-right {
    text-align: right;
    flex: 1;
    min-width: 260px;
}
.site-footer .footer-designed {
    font-size: 0.9rem;
    margin-bottom: 6px;
}
.site-footer .footer-designed .by {
    color: #94a3b8;
    margin-right: 6px;
}
.site-footer .pgd-link {
    color: #c5a44e;
    text-decoration: none;
    font-weight: 600;
    transition: opacity var(--transition);
}
.site-footer .pgd-link:hover { opacity: 0.85; }
.site-footer .pgd-link strong {
    color: #c5a44e;
    letter-spacing: 2px;
    font-weight: 800;
}
.site-footer .footer-contact {
    color: #64748b;
    font-size: 0.82rem;
}
.site-footer .footer-contact .sep { margin: 0 8px; }
.site-footer .footer-contact i { margin-right: 4px; color: #94a3b8; }
.site-footer .footer-bottom {
    text-align: center;
    padding-top: 18px;
    color: #64748b;
    font-size: 0.8rem;
}

/* RTL footer */
[dir="rtl"] .site-footer .footer-right { text-align: left; }
[dir="rtl"] .site-footer .footer-designed .by { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .site-footer .footer-contact i { margin-right: 0; margin-left: 4px; }

/* Mobile footer */
@media (max-width: 767px) {
    .site-footer .footer-inner { flex-direction: column; text-align: center; gap: 18px; }
    .site-footer .footer-right { text-align: center; }
}

/* ---- Alerts ---- */
.alert { border-radius: var(--radius); font-weight: 500; font-size: 0.9rem; }

/* ---- Breadcrumbs ---- */
.breadcrumb { font-size: 0.875rem; font-weight: 500; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---- Print ---- */
@media print {
    .no-print { display: none !important; }
    body { background: #fff !important; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; }
}

/* ---- RTL / Arabic ---- */
[dir="rtl"] body {
    font-family: 'Noto Sans Arabic', 'Inter', sans-serif !important;
}
[dir="rtl"] .group-header {
    flex-direction: row-reverse;
}
[dir="rtl"] .group-header::before {
    margin-right: 0;
    margin-left: 12px;
}
[dir="rtl"] .item-card .original-price {
    margin-right: 0;
    margin-left: 8px;
}
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: 0.5rem;
    padding-right: 0;
}

/* ================================================================
   DARK MODE
   ================================================================ */
[data-bs-theme="dark"] {
    --surface: #1e293b;
    --border: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --light: #0f172a;
}

[data-bs-theme="dark"] body {
    background: #0f172a;
}
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .login-card,
[data-bs-theme="dark"] .filter-form {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}
[data-bs-theme="dark"] .card-header {
    border-bottom-color: var(--border);
}
[data-bs-theme="dark"] .item-card {
    background: var(--surface) !important;
    border-color: var(--border) !important;
}
[data-bs-theme="dark"] .item-card .card-body { background: var(--surface); }
[data-bs-theme="dark"] .item-card .card-title { color: var(--text-primary); }
[data-bs-theme="dark"] .no-image { background: linear-gradient(135deg, #1e293b, #334155); }
[data-bs-theme="dark"] .table th { color: var(--text-muted); border-bottom-color: var(--border); }
[data-bs-theme="dark"] .table td { color: var(--text-secondary); }
[data-bs-theme="dark"] .table-hover tbody tr:hover { background-color: rgba(255,255,255,0.04); }
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background: #0f172a;
    border-color: var(--border);
    color: var(--text-primary);
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: var(--primary);
    background: #0f172a;
}
[data-bs-theme="dark"] .supplier-badge { background: #334155; color: var(--text-secondary); }
[data-bs-theme="dark"] .navbar { background: rgba(15, 23, 42, 0.97) !important; }
[data-bs-theme="dark"] .group-header { color: var(--text-primary); }
[data-bs-theme="dark"] footer { border-top-color: var(--border); }

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
