/* ═══════════════════════════════════════════════════════════════
   Vileson Trade FZCO — Client Portal CSS
   Brand: primary #0b3d2e · accent #2ecc8f · text #111e1a
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: 'DM Sans', 'Segoe UI', Arial, sans-serif; background: #f4f7f5; color: #111e1a; min-height: 100vh; }
a { color: #0b3d2e; text-decoration: none; }
a:hover { color: #2ecc8f; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }

/* ── CSS Variables ── */
:root {
  --primary:    #0b3d2e;
  --primary-lt: #155c44;
  --accent:     #2ecc8f;
  --accent-dk:  #1fa870;
  --danger:     #e74c3c;
  --warning:    #f39c12;
  --success:    #27ae60;
  --text:       #111e1a;
  --text-mid:   #3d5049;
  --text-muted: #7a9186;
  --border:     #d4e8e1;
  --bg:         #f4f7f5;
  --bg-soft:    #eaf4f0;
  --white:      #ffffff;
  --sidebar-w:  240px;
  --radius:     10px;
  --shadow:     0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
}

/* ══════════════════════════════════════════════
   AUTH PAGES (login / register)
══════════════════════════════════════════════ */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); padding: 20px; }
.auth-box { background: var(--white); border-radius: 16px; padding: 44px 40px; width: 100%; max-width: 420px; box-shadow: 0 8px 40px rgba(0,0,0,.25); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-name { display: block; font-size: 20px; font-weight: 700; color: var(--primary); letter-spacing: -.3px; }
.auth-logo .logo-sub  { display: block; font-size: 11px; font-weight: 500; color: var(--accent); letter-spacing: 2px; text-transform: uppercase; margin-top: 2px; }
.auth-logo .logo-icon { width: 48px; height: 48px; background: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.auth-logo .logo-icon svg { width: 28px; height: 28px; }
.auth-title { font-size: 19px; font-weight: 600; color: var(--primary); margin-bottom: 6px; text-align: center; }
.auth-sub   { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.auth-box .form-group { margin-bottom: 16px; }
.auth-box label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; letter-spacing: .3px; }
.auth-box input, .auth-box select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 14px; color: var(--text);
  background: var(--bg); transition: border-color .15s;
}
.auth-box input:focus, .auth-box select:focus { outline: none; border-color: var(--accent); background: var(--white); }
.auth-box .btn-primary { width: 100%; padding: 12px; background: var(--primary); color: var(--white); font-weight: 700; border: none; border-radius: var(--radius); cursor: pointer; font-size: 15px; transition: background .15s; }
.auth-box .btn-primary:hover { background: var(--primary-lt); }
.auth-link { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.auth-link a { color: var(--accent-dk); font-weight: 600; }
.auth-alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; }
.auth-alert.error   { background: #fdf0ef; border-left: 3px solid var(--danger);  color: #a33; }
.auth-alert.success { background: #eaf7f0; border-left: 3px solid var(--success); color: #1a6b3c; }
.auth-alert.info    { background: #eaf4f0; border-left: 3px solid var(--accent);  color: var(--primary); }

/* ══════════════════════════════════════════════
   PORTAL LAYOUT
══════════════════════════════════════════════ */
.portal-wrap { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar { width: var(--sidebar-w); background: var(--primary); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; overflow-y: auto; }
.sidebar-brand { padding: 22px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .brand-name { font-size: 15px; font-weight: 700; color: var(--white); display: block; }
.sidebar-brand .brand-sub  { font-size: 10px; font-weight: 500; color: rgba(255,255,255,.45); letter-spacing: 2px; text-transform: uppercase; }
.sidebar-brand .brand-icon { font-size: 22px; margin-bottom: 6px; display: block; }
.sidebar-user { padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-user .su-name    { font-size: 13px; font-weight: 600; color: var(--white); display: block; }
.sidebar-user .su-company { font-size: 11px; color: rgba(255,255,255,.5); display: block; }
.sidebar-user .su-badge   { display: inline-block; font-size: 10px; font-weight: 600; background: var(--accent); color: var(--primary); padding: 1px 8px; border-radius: 20px; margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.sidebar-nav .nav-section { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,.3); padding: 12px 20px 4px; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 20px; font-size: 13.5px; font-weight: 500; color: rgba(255,255,255,.7); transition: background .1s, color .1s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.08); color: var(--white); }
.sidebar-nav a.active { border-left: 3px solid var(--accent); }
.sidebar-nav a .nav-icon { font-size: 16px; flex-shrink: 0; opacity: .8; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer a { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255,255,255,.5); }
.sidebar-footer a:hover { color: var(--white); }

/* ── Main content ── */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 14px 32px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 17px; font-weight: 600; color: var(--primary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-wa { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--white); background: #25D366; padding: 6px 14px; border-radius: 20px; }
.page-content { padding: 28px 32px; }

/* ══════════════════════════════════════════════
   COMPONENTS
══════════════════════════════════════════════ */

/* Cards */
.card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; color: var(--primary); }
.card-body { padding: 20px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card.accent { border-top: 3px solid var(--accent); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-val   { font-size: 26px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th { background: var(--bg-soft); color: var(--primary); font-weight: 600; padding: 10px 14px; text-align: left; border-bottom: 1.5px solid var(--border); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
table.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-mid); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--bg); }

/* Badges / pills */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.badge-pending   { background: #fef5e7; color: #7d5a00; }
.badge-active    { background: #eaf7f0; color: #1a6b3c; }
.badge-suspended { background: #fdf0ef; color: #a33; }
.badge-confirmed  { background: #eaf4f0; color: var(--primary); }
.badge-processing { background: #e6f1fb; color: #185fa5; }
.badge-shipped    { background: #fef5e7; color: #7d5a00; }
.badge-delivered  { background: #eaf7f0; color: #1a6b3c; }
.badge-cancelled  { background: #f0f0f0; color: #666; }
.badge-unpaid  { background: #fdf0ef; color: #a33; }
.badge-paid    { background: #eaf7f0; color: #1a6b3c; }
.badge-overdue { background: #fdf0ef; color: #a33; border: 1px solid #f5c6c6; }
.badge-void    { background: #f0f0f0; color: #888; }
.badge-sds      { background: #e6f1fb; color: #185fa5; }
.badge-coa      { background: #eaf7f0; color: #1a6b3c; }
.badge-haccp    { background: #fef5e7; color: #7d5a00; }
.badge-virucidal { background: #f5edfb; color: #6b1fa8; }
.badge-other    { background: #f0f0f0; color: #666; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: opacity .15s; text-decoration: none; }
.btn:hover { opacity: .88; }
.btn-primary   { background: var(--primary); color: var(--white); }
.btn-accent    { background: var(--accent); color: var(--primary); }
.btn-danger    { background: var(--danger); color: var(--white); }
.btn-outline   { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-wa { background: #25D366; color: #fff; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 13px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; color: var(--text);
  background: var(--bg); transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); background: var(--white); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 18px; }
.alert-success { background: #eaf7f0; border-left: 3px solid var(--success); color: #1a6b3c; }
.alert-error   { background: #fdf0ef; border-left: 3px solid var(--danger);  color: #a33; }
.alert-info    { background: #eaf4f0; border-left: 3px solid var(--accent);  color: var(--primary); }
.alert-warning { background: #fef5e7; border-left: 3px solid var(--warning); color: #7d5a00; }

/* Empty state */
.empty-state { text-align: center; padding: 52px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; display: block; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* WhatsApp messages */
.wa-thread { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: #e5ddd5; border-radius: 8px; min-height: 200px; }
.wa-msg { max-width: 75%; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; position: relative; }
.wa-msg.in  { background: var(--white); align-self: flex-start; border-top-left-radius: 2px; }
.wa-msg.out { background: #dcf8c6; align-self: flex-end; border-top-right-radius: 2px; }
.wa-msg .wa-meta { font-size: 11px; color: #888; margin-top: 4px; text-align: right; }

/* Pagination */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 7px; font-size: 13px; font-weight: 500; border: 1px solid var(--border); color: var(--text-mid); }
.pagination a:hover { border-color: var(--accent); color: var(--primary); }
.pagination .current { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* Breadcrumb */
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; display: flex; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { opacity: .4; }

/* Admin-specific */
.admin-tag { display: inline-block; font-size: 10px; font-weight: 700; background: var(--accent); color: var(--primary); padding: 1px 7px; border-radius: 10px; vertical-align: middle; margin-left: 6px; }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .mobile-menu-btn { display: flex; }
}
.mobile-menu-btn { display: none; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--primary); background: none; border: none; cursor: pointer; padding: 4px 8px; }
