/* QuoFret - Modern Logistics ERP */
:root {
  --primary: #1a6fb5;
  --primary-dark: #144f85;
  --primary-light: #e8f1fb;
  --success: #27ae60;
  --success-dark: #1e8449;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #17a2b8;
  --dark: #2c3e50;
  --gray: #6c757d;
  --light-gray: #f8f9fa;
  --border: #dee2e6;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 8px;
  --shadow: 0 2px 10px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f0f4f8; color: var(--dark); }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1a2940 0%, #0d1f36 100%);
  display: flex; flex-direction: column;
  z-index: 100; transition: transform 0.3s ease;
  box-shadow: 4px 0 20px rgba(0,0,0,0.2);
}
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo h1 {
  color: #fff; font-size: 22px; font-weight: 800; letter-spacing: -0.5px;
}
.sidebar-logo h1 span { color: #4da3ff; }
.sidebar-logo small { color: rgba(255,255,255,0.4); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section { padding: 8px 16px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: rgba(255,255,255,0.3); }
.nav-item { display: block; padding: 9px 16px; color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13.5px; border-left: 3px solid transparent; transition: all 0.2s; display: flex; align-items: center; gap: 10px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); border-left-color: rgba(255,255,255,0.2); }
.nav-item.active { color: #fff; background: rgba(77,163,255,0.15); border-left-color: #4da3ff; }
.nav-item i { width: 16px; text-align: center; font-size: 14px; }

.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.08);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; background: linear-gradient(135deg, #4da3ff, #2980b9); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; }
.user-role { color: rgba(255,255,255,0.4); font-size: 11px; }

/* ── MAIN ── */
.main { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }

/* ── TOPBAR ── */
.topbar {
  height: var(--header-height); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 17px; font-weight: 700; color: var(--dark); }
.breadcrumb { font-size: 12px; color: var(--gray); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-btn { background: none; border: none; cursor: pointer; color: var(--gray); font-size: 16px; padding: 6px; border-radius: 6px; transition: all 0.2s; }
.topbar-btn:hover { background: var(--light-gray); color: var(--dark); }

/* ── CONTENT ── */
.content { flex: 1; padding: 24px; }

/* ── CARDS ── */
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.04);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--dark); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); border: 1px solid rgba(0,0,0,0.04);
  display: flex; align-items: center; gap: 14px;
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.blue { background: #e8f1fb; color: var(--primary); }
.stat-icon.green { background: #e8f8f0; color: var(--success); }
.stat-icon.orange { background: #fef5e7; color: var(--warning); }
.stat-icon.red { background: #fdf0ef; color: var(--danger); }
.stat-icon.purple { background: #f3eeff; color: #8e44ad; }
.stat-icon.cyan { background: #e8f8fb; color: var(--info); }
.stat-value { font-size: 26px; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray); margin-top: 2px; }

/* ── TABLES ── */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: #f8f9fa; padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); border-bottom: 2px solid var(--border); }
tbody td { padding: 12px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 6px; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; transition: all 0.2s; white-space: nowrap; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 4px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--dark); }
.btn-outline:hover { background: var(--light-gray); }
.btn-ghost { background: transparent; color: var(--gray); }
.btn-ghost:hover { background: var(--light-gray); color: var(--dark); }

/* ── FORMS ── */
.form-grid { display: grid; gap: 20px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--dark); }
.form-control {
  width: 100%; padding: 9px 13px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 14px; color: var(--dark); background: #fff; transition: border-color 0.2s;
  appearance: none;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,111,181,0.1); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--gray); }

/* ── BADGES ── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.badge-draft { background: #f0f0f0; color: #666; }
.badge-sent { background: #dbeafe; color: #1d4ed8; }
.badge-won { background: #dcfce7; color: #166534; }
.badge-lost { background: #fee2e2; color: #991b1b; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #d4edda; color: #155724; border-left: 4px solid var(--success); }
.alert-error { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger); }
.alert-info { background: #d1ecf1; color: #0c5460; border-left: 4px solid var(--info); }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 9px 16px; font-size: 13.5px; font-weight: 600; color: var(--gray); cursor: pointer; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; border-radius: 6px 6px 0 0; }
.tab:hover { color: var(--primary); background: var(--primary-light); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }

/* ── LOGIN PAGE ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0d1f36 0%, #1a6fb5 100%); }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 36px; font-weight: 900; color: var(--dark); letter-spacing: -1px; }
.login-logo h1 span { color: var(--primary); }
.login-logo p { color: var(--gray); font-size: 13px; margin-top: 4px; }

/* ── DASHBOARD GRID ── */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* ── OFFER STATUS COLORS ── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.draft { background: #aaa; }
.status-dot.sent { background: #3498db; }
.status-dot.won { background: var(--success); }
.status-dot.lost { background: var(--danger); }

/* ── ACTION ROW ── */
.action-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.action-row-left { display: flex; align-items: center; gap: 10px; }

/* ── CONSTANTS GRID ── */
.constants-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 800px) { .constants-grid { grid-template-columns: 1fr 1fr; } }
.const-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; text-align: center; border: 1px solid rgba(0,0,0,0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}
.const-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.const-card-icon { font-size: 32px; margin-bottom: 10px; }
.const-card-title { font-size: 15px; font-weight: 700; color: var(--dark); margin-bottom: 16px; }
.const-card .btn { width: 100%; justify-content: center; margin-bottom: 8px; }

/* ── DETAIL VIEW ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.detail-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f5f5f5; font-size: 14px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--gray); }
.detail-value { font-weight: 600; color: var(--dark); }

/* ── FREIGHT PRICE BOX ── */
.price-boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.price-box { background: var(--primary-light); border: 1px solid rgba(26,111,181,0.2); border-radius: 8px; padding: 14px; text-align: center; }
.price-box-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary); font-weight: 700; margin-bottom: 4px; }
.price-box-value { font-size: 22px; font-weight: 800; color: var(--dark); }
.price-box-currency { font-size: 12px; color: var(--gray); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray); }
.empty-state i { font-size: 48px; opacity: 0.3; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 15px; }

/* ── CHARGE TABLE ── */
.charge-section { margin-bottom: 20px; }
.charge-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary); padding: 8px 14px; background: var(--primary-light); border-radius: 6px; margin-bottom: 8px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .price-boxes { grid-template-columns: 1fr; }
  .constants-grid { grid-template-columns: 1fr 1fr; }
}

/* ── UTILS ── */
.text-muted { color: var(--gray); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ms-auto { margin-left: auto; }
