/* ============================================================
   Sinovaly Partner Portal — Global Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: #f0f4f8;
    color: #1e293b;
    margin: 0;
}

/* ---- Sidebar Layout ---- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px; min-height: 100vh;
    background: linear-gradient(180deg, #0a1628 0%, #0d2137 60%, #0a1628 100%);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    transition: width 0.3s ease;
}

.sidebar-brand {
    padding: 28px 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 14px;
}
.sidebar-brand .brand-icon {
    width: 42px; height: 42px; border-radius: 12px;
    background: linear-gradient(135deg, #d4a017, #f0c940);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; box-shadow: 0 4px 12px rgba(212,160,23,0.4);
}
.sidebar-brand .brand-icon img { width: 28px; height: 28px; object-fit: contain; }
.sidebar-brand .brand-icon span { font-size: 1.2rem; font-weight: 800; color: #0a1628; }
.sidebar-brand h5 { color: #fff; font-size: 0.95rem; font-weight: 700; margin: 0; }
.sidebar-brand p  { color: rgba(255,255,255,0.4); font-size: 0.72rem; margin: 2px 0 0; }

.sidebar-nav { flex: 1; padding: 20px 0; overflow-y: auto; }

.nav-section-title {
    color: rgba(255,255,255,0.3); font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
    padding: 12px 24px 6px; margin-top: 8px;
}

.nav-item { margin: 2px 12px; }
.nav-link-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    color: rgba(255,255,255,0.55); font-size: 0.88rem; font-weight: 500;
    text-decoration: none; transition: all 0.2s;
}
.nav-link-item:hover {
    background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9);
}
.nav-link-item.active {
    background: linear-gradient(135deg, rgba(212,160,23,0.2), rgba(240,201,64,0.1));
    color: #f0c940; border: 1px solid rgba(212,160,23,0.3);
}
.nav-link-item i { width: 18px; text-align: center; font-size: 1rem; }
.nav-link-item .badge-count {
    margin-left: auto; background: #d4a017; color: #0a1628;
    font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 10px;
}

.sidebar-footer {
    padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.2);
}
.sidebar-user { display: flex; align-items: center; gap: 12px; }
.sidebar-user .avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg,#d4a017,#f0c940);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.95rem; color: #0a1628; flex-shrink: 0;
}
.sidebar-user .user-info h6 { color: #fff; font-size: 0.83rem; margin: 0; font-weight: 600; }
.sidebar-user .user-info small { color: rgba(255,255,255,0.4); font-size: 0.72rem; }
.sidebar-user .logout-btn {
    margin-left: auto; color: rgba(255,255,255,0.4); font-size: 1rem;
    text-decoration: none; transition: color 0.2s;
}
.sidebar-user .logout-btn:hover { color: #ef4444; }

/* ---- Main Content ---- */
.main-content {
    margin-left: 260px; flex: 1;
    display: flex; flex-direction: column; min-height: 100vh;
}

.topbar {
    background: #fff; padding: 14px 28px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #e8ecf0;
    position: sticky; top: 0; z-index: 900;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.topbar h4 { font-size: 1.1rem; font-weight: 700; color: #0a1628; margin: 0; }
.topbar .breadcrumb-item { font-size: 0.8rem; }
.topbar .topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar-badge { position: relative; }
.topbar-badge .dot {
    position: absolute; top: -2px; right: -2px;
    width: 8px; height: 8px; border-radius: 50%;
    background: #ef4444; border: 2px solid #fff;
}

.page-content { padding: 28px; flex: 1; }

/* ---- Stats Cards ---- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 20px; margin-bottom: 28px; }

.stat-card {
    background: #fff; border-radius: 16px; padding: 22px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #f0f4f8; position: relative; overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.stat-card .card-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; margin-bottom: 14px;
}
.stat-card .card-value { font-size: 1.8rem; font-weight: 800; color: #0a1628; line-height: 1; }
.stat-card .card-label { color: #64748b; font-size: 0.82rem; font-weight: 500; margin-top: 6px; }
.stat-card .card-change { font-size: 0.78rem; margin-top: 8px; font-weight: 600; }
.stat-card .card-change.up { color: #22c55e; }
.stat-card .card-change.down { color: #ef4444; }
.stat-card::after {
    content: ''; position: absolute; bottom: -20px; right: -20px;
    width: 80px; height: 80px; border-radius: 50%;
    opacity: 0.08;
}

.stat-card.blue   .card-icon { background: #eff6ff; color: #3b82f6; }
.stat-card.blue::after   { background: #3b82f6; }
.stat-card.gold   .card-icon { background: #fefce8; color: #d4a017; }
.stat-card.gold::after   { background: #d4a017; }
.stat-card.green  .card-icon { background: #f0fdf4; color: #22c55e; }
.stat-card.green::after  { background: #22c55e; }
.stat-card.red    .card-icon { background: #fef2f2; color: #ef4444; }
.stat-card.red::after    { background: #ef4444; }
.stat-card.purple .card-icon { background: #faf5ff; color: #8b5cf6; }
.stat-card.purple::after { background: #8b5cf6; }
.stat-card.orange .card-icon { background: #fff7ed; color: #f97316; }
.stat-card.orange::after { background: #f97316; }

/* ---- Status Badges ---- */
.status-badge {
    display: inline-flex; align-items: center; padding: 4px 12px;
    border-radius: 20px; font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.badge-ordered    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-purchased  { background: #faf5ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.badge-shipped    { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge-customs    { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-office     { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* Status Progress Bar */
.status-progress { display: flex; align-items: center; gap: 0; margin: 20px 0; overflow-x: auto; padding: 4px 0; }
.status-step {
    display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; min-width: 100px;
}
.status-step::before {
    content: ''; position: absolute; top: 16px; left: 50%; right: -50%;
    height: 3px; background: #e2e8f0; z-index: 0;
}
.status-step:last-child::before { display: none; }
.status-step .step-dot {
    width: 32px; height: 32px; border-radius: 50%; background: #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; color: #94a3b8; z-index: 1; position: relative;
    border: 3px solid #fff; box-shadow: 0 0 0 2px #e2e8f0;
    transition: all 0.3s;
}
.status-step.done .step-dot   { background: #22c55e; color: #fff; box-shadow: 0 0 0 2px #22c55e; }
.status-step.active .step-dot { background: #d4a017; color: #fff; box-shadow: 0 0 0 2px #d4a017; animation: stepPulse 2s infinite; }
@keyframes stepPulse { 0%,100%{box-shadow:0 0 0 2px #d4a017} 50%{box-shadow:0 0 0 6px rgba(212,160,23,0.3)} }
.status-step.done::before { background: #22c55e; }
.status-step .step-label { font-size: 0.72rem; text-align: center; margin-top: 8px; color: #94a3b8; font-weight: 500; }
.status-step.done .step-label   { color: #22c55e; font-weight: 600; }
.status-step.active .step-label { color: #d4a017; font-weight: 700; }

/* ---- Tables ---- */
.data-table { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.06); margin-bottom: 24px; }
.data-table .table-header {
    padding: 18px 24px; border-bottom: 1px solid #f0f4f8;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.data-table .table-header h5 { font-size: 1rem; font-weight: 700; color: #0a1628; margin: 0; }
.data-table table { width: 100%; margin: 0; }
.data-table table th {
    background: #f8fafc; font-size: 0.78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; color: #64748b;
    padding: 12px 16px; border-bottom: 1px solid #f0f4f8; white-space: nowrap;
}
.data-table table td { padding: 14px 16px; border-bottom: 1px solid #f8fafc; font-size: 0.88rem; vertical-align: middle; }
.data-table table tr:last-child td { border-bottom: none; }
.data-table table tr:hover td { background: #fafbfc; }

/* ---- Cards ---- */
.content-card { background: #fff; border-radius: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); margin-bottom: 24px; border: 1px solid #f0f4f8; }
.content-card .card-head { padding: 18px 24px; border-bottom: 1px solid #f0f4f8; display: flex; align-items: center; justify-content: space-between; }
.content-card .card-head h5 { font-size: 1rem; font-weight: 700; margin: 0; color: #0a1628; }
.content-card .card-body { padding: 24px; }

/* ---- Buttons ---- */
.btn-primary-gold { background: linear-gradient(135deg,#d4a017,#f0c940); border: none; color: #0a1628; font-weight: 600; border-radius: 10px; transition: all 0.2s; }
.btn-primary-gold:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(212,160,23,0.3); color: #0a1628; }
.btn-outline-gold { border: 2px solid #d4a017; color: #d4a017; background: transparent; font-weight: 600; border-radius: 10px; transition: all 0.2s; }
.btn-outline-gold:hover { background: #d4a017; color: #0a1628; }

/* ---- Forms ---- */
.form-control, .form-select {
    border: 2px solid #e8ecf0; border-radius: 10px; padding: 10px 14px;
    font-size: 0.9rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: #d4a017; box-shadow: 0 0 0 0.2rem rgba(212,160,23,0.15); outline: none;
}
.form-label { font-weight: 600; font-size: 0.85rem; color: #374151; margin-bottom: 6px; }

/* ---- Order Item Row ---- */
.order-item-row { background: #f8fafc; border-radius: 12px; padding: 18px; margin-bottom: 14px; border: 2px solid #e8ecf0; position: relative; }
.order-item-row .remove-item { position: absolute; top: 10px; right: 14px; color: #ef4444; cursor: pointer; font-size: 1rem; }

/* ---- Partner Card ---- */
.partner-card {
    background: #fff; border-radius: 14px; padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06); border: 1px solid #f0f4f8;
    transition: transform 0.2s, box-shadow 0.2s;
}
.partner-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.partner-card .partner-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg,#d4a017,#f0c940);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.2rem; color: #0a1628;
}

/* ---- Alert ---- */
.alert { border-radius: 12px; border: none; font-size: 0.9rem; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fefce8; color: #92400e; border: 1px solid #fde68a; }

/* ---- Image Preview ---- */
.img-preview-wrap { width: 80px; height: 80px; border-radius: 10px; overflow: hidden; background: #f0f4f8; border: 2px dashed #d4a017; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.img-preview-wrap img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-wrap i { font-size: 1.5rem; color: #d4a017; }

/* ---- Notification Bar ---- */
.notify-bar { background: linear-gradient(135deg,#0a1628,#1a3a5c); border-radius: 14px; padding: 18px 24px; color: #fff; margin-bottom: 24px; display: flex; align-items: center; gap: 16px; }
.notify-bar i { font-size: 1.5rem; color: #d4a017; }
.notify-bar .notify-text h6 { margin: 0; font-weight: 700; font-size: 0.9rem; }
.notify-bar .notify-text p { margin: 4px 0 0; font-size: 0.8rem; color: rgba(255,255,255,0.6); }
.notify-bar .notify-actions { margin-left: auto; display: flex; gap: 10px; }

/* ---- Shipping Slot Summary ---- */
.slot-summary-card {
    border-radius: 14px; padding: 20px 24px;
    background: linear-gradient(135deg,#0a1628 0%,#1a3a5c 100%);
    color: #fff; margin-bottom: 20px;
}
.slot-summary-card h6 { color: rgba(255,255,255,0.6); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 4px; }
.slot-summary-card .val { font-size: 1.4rem; font-weight: 800; color: #f0c940; }

/* ---- Mobile Responsive ---- */
@media (max-width: 992px) {
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 260px; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .menu-toggle { display: block !important; }
}

.menu-toggle { display: none; background: none; border: none; font-size: 1.3rem; color: #0a1628; cursor: pointer; }

/* ---- Utils ---- */
.fw-600 { font-weight: 600; }
.text-gold { color: #d4a017; }
.bg-gold-light { background: #fefce8; }
.rounded-12 { border-radius: 12px !important; }
.rounded-16 { border-radius: 16px !important; }

/* ---- Product image in table ---- */
.product-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 2px solid #f0f4f8; }
.product-thumb-placeholder { width: 44px; height: 44px; border-radius: 8px; background: #f0f4f8; display: flex; align-items: center; justify-content: center; }

/* ---- Page Header ---- */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 1.5rem; font-weight: 800; color: #0a1628; margin: 0; }
.page-header p { color: #64748b; font-size: 0.88rem; margin: 4px 0 0; }

/* ---- Financial summary footer row ---- */
.total-row td { background: #fafbfc; font-weight: 700; color: #0a1628; border-top: 2px solid #e8ecf0 !important; }

/* ---- Overlay for mobile sidebar ---- */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }
.sidebar-overlay.show { display: block; }
