/* ─── CourierTrack Pro - Main Stylesheet ──────────────────────────────────── */
:root {
  --primary: #1a73e8;
  --primary-dark: #0d47a1;
  --secondary: #34a853;
  --warning: #fbbc04;
  --danger: #ea4335;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --text: #202124;
  --text-muted: #5f6368;
  --border: #dadce0;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.page-wrap  { padding: 30px 0; }

/* ─── Header ─────────────────────────────────────────────────────────────── */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px;
}
.header-logo { display: flex; align-items: center; gap: 10px; }
.header-logo h1 { font-size: 22px; font-weight: 700; }
.header-logo span { font-size: 12px; opacity: .8; display: block; }
.header-nav a {
  color: rgba(255,255,255,.85); padding: 8px 14px;
  border-radius: 6px; font-size: 14px; transition: background .2s;
}
.header-nav a:hover { background: rgba(255,255,255,.15); text-decoration: none; }
.header-nav a.active { background: rgba(255,255,255,.2); }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px;
}
.card-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--primary); }

/* ─── Stats Grid ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); text-align: center; border-top: 4px solid var(--primary);
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .stat-num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-card.delivered { border-color: var(--secondary); }
.stat-card.delivered .stat-num { color: var(--secondary); }
.stat-card.transit { border-color: var(--warning); }
.stat-card.transit .stat-num { color: #e6a800; }
.stat-card.out { border-color: #f4511e; }
.stat-card.out .stat-num { color: #f4511e; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 7px; font-size: 15px; transition: border .2s, box-shadow .2s;
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:600px) { .form-row { grid-template-columns: 1fr; } }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 22px; border: none; border-radius: 7px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 3px 10px rgba(26,115,232,.4); }
.btn-success { background: var(--secondary); color: #fff; }
.btn-success:hover { background: #2d9248; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c62828; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 7px; font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #e6f4ea; color: #137333; border-left: 4px solid var(--secondary); }
.alert-danger  { background: #fce8e6; color: #c5221f; border-left: 4px solid var(--danger); }
.alert-info    { background: #e8f0fe; color: #1a73e8; border-left: 4px solid var(--primary); }
.alert-warning { background: #fef7e0; color: #b45309; border-left: 4px solid var(--warning); }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-order-received   { background: #e8f0fe; color: #1a73e8; }
.badge-processing       { background: #fef7e0; color: #b45309; }
.badge-shipped          { background: #e6f4ea; color: #137333; }
.badge-in-transit       { background: #e8f0fe; color: #1967d2; }
.badge-out-for-delivery { background: #fce8e6; color: #c5221f; }
.badge-delivered        { background: #e6f4ea; color: #0d652d; }

/* ─── Table ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--bg); padding: 12px 14px; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
tbody td { padding: 12px 14px; border-bottom: 1px solid #f0f0f0; }
tbody tr:hover { background: #f8f9ff; }

/* ─── Search Bar ─────────────────────────────────────────────────────────── */
.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-bar .form-control { flex: 1; }

/* ─── Tracking Page ──────────────────────────────────────────────────────── */
.tracking-hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 60px 20px; text-align: center; color: #fff;
}
.tracking-hero h2 { font-size: 32px; margin-bottom: 8px; }
.tracking-hero p  { opacity: .85; margin-bottom: 24px; }
.tracking-search-box {
  display: flex; max-width: 500px; margin: 0 auto; gap: 10px;
}
.tracking-search-box .form-control {
  flex: 1; padding: 14px 18px; font-size: 16px; border-radius: 8px;
  border: none; box-shadow: 0 3px 10px rgba(0,0,0,.2);
}
.tracking-search-box .btn { padding: 14px 24px; font-size: 15px; }

.tracking-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 24px 0; }
.tracking-card-header { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; }
.tracking-card-header h3 { font-size: 20px; }
.tracking-card-body { padding: 24px; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media(max-width:600px){ .info-grid { grid-template-columns: 1fr; } }
.info-box { background: var(--bg); border-radius: 8px; padding: 16px; }
.info-box h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.info-box p  { font-size: 14px; line-height: 1.7; }

/* ─── Progress Bar ───────────────────────────────────────────────────────── */
.progress-wrap { margin: 24px 0; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.progress-bar { background: #e9ecef; border-radius: 20px; height: 10px; }
.progress-fill { background: linear-gradient(90deg, var(--primary), var(--secondary)); height: 100%; border-radius: 20px; transition: width .6s ease; }
.steps-row { display: flex; justify-content: space-between; margin-top: 10px; }
.step-dot { text-align: center; flex: 1; }
.step-dot .dot { width: 14px; height: 14px; border-radius: 50%; background: #ccc; margin: 0 auto 4px; }
.step-dot.active .dot, .step-dot.done .dot { background: var(--primary); }
.step-dot span { font-size: 10px; color: var(--text-muted); display: block; }

/* ─── Timeline ───────────────────────────────────────────────────────────── */
.timeline { position: relative; padding: 0 0 0 30px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: #e0e0e0; }
.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-item::before {
  content: ''; position: absolute; left: -24px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #ccc; border: 2px solid #fff;
  box-shadow: 0 0 0 2px #ccc;
}
.timeline-item.active::before { background: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.3); }
.timeline-item.custom::before { background: var(--warning); box-shadow: 0 0 0 3px rgba(251,188,4,.3); }
.timeline-date { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.timeline-status { font-size: 15px; font-weight: 600; color: var(--text); }
.timeline-message { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.timeline-location { font-size: 12px; color: var(--primary); margin-top: 2px; }
.custom-tag { font-size: 11px; background: #fef7e0; color: #b45309; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }

/* ─── Login ──────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { color: var(--primary); font-size: 26px; }
.login-logo p  { color: var(--text-muted); font-size: 13px; }

/* ─── Charts ─────────────────────────────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media(max-width:800px){ .charts-grid { grid-template-columns: 1fr; } }
.chart-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.chart-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.chart-container { position: relative; height: 220px; }

/* ─── Activity Feed ──────────────────────────────────────────────────────── */
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.activity-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.activity-text { flex: 1; font-size: 13px; }
.activity-text strong { color: var(--text); }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Email Settings ─────────────────────────────────────────────────────── */
.settings-section { border-bottom: 1px solid var(--border); padding-bottom: 24px; margin-bottom: 24px; }
.settings-section:last-child { border-bottom: none; }
.settings-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.toggle-switch { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.toggle-switch input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 60px); }
.sidebar { background: #fff; border-right: 1px solid var(--border); padding: 20px 0; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 11px 20px;
  color: var(--text-muted); font-size: 14px; font-weight: 500; transition: all .2s;
}
.sidebar-link:hover, .sidebar-link.active { background: #e8f0fe; color: var(--primary); text-decoration: none; }
.sidebar-link .icon { font-size: 18px; }
.main-content { padding: 28px 24px; }
@media(max-width:768px){ .admin-layout { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 12px; padding: 28px; max-width: 500px; width: 90%; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); }

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.text-center { text-align: center; }
.d-flex { display: flex; } .align-center { align-items: center; } .gap-2 { gap: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ─── Print ──────────────────────────────────────────────────────────────── */
@media print {
  header, .sidebar, .btn, .search-bar { display: none !important; }
  .card, .tracking-card { box-shadow: none; border: 1px solid #ddd; }
}
