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

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f2f4f9;
  color: #2b2f38;
  -webkit-font-smoothing: antialiased;
}

/* Login */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f2350 0%, #1e3c72 45%, #2a5298 100%);
  position: relative;
  overflow: hidden;
}

.login-body::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  top: -200px;
  right: -200px;
}

.login-body::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  bottom: -200px;
  left: -200px;
}

.login-container {
  background: white;
  padding: 42px 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 400px;
  position: relative;
  z-index: 1;
}

.login-container h2 {
  text-align: center;
  margin-bottom: 28px;
  color: #1e3c72;
  font-weight: 800;
  letter-spacing: -0.3px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
  color: #45495a;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e3e6ee;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fbfcfe;
  transition: 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2a5298;
  background: white;
  box-shadow: 0 0 0 3px rgba(42,82,152,0.12);
}

.form-group textarea {
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: 0.2s;
  letter-spacing: 0.1px;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: #2a5298; color: white; box-shadow: 0 2px 8px rgba(42,82,152,0.25); }
.btn-primary:hover { background: #1e3c72; box-shadow: 0 4px 14px rgba(42,82,152,0.35); }
.btn-success { background: #1fa855; color: white; box-shadow: 0 2px 8px rgba(31,168,85,0.25); }
.btn-success:hover { background: #178f47; box-shadow: 0 4px 14px rgba(31,168,85,0.35); }
.btn-danger { background: #e0394b; color: white; box-shadow: 0 2px 8px rgba(224,57,75,0.25); }
.btn-danger:hover { background: #c62839; box-shadow: 0 4px 14px rgba(224,57,75,0.35); }
.btn-warning { background: #ffc107; color: #3a3000; box-shadow: 0 2px 8px rgba(255,193,7,0.25); }
.btn-warning:hover { background: #e0a800; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

/* Alerts */
.alert {
  padding: 13px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  border-left: 4px solid transparent;
}

.alert-error { background: #fdeced; color: #9c2431; border-left-color: #e0394b; }
.alert-success { background: #e8f8ee; color: #146c37; border-left-color: #1fa855; }
.alert-info { background: #e8f2fb; color: #0d4f7a; border-left-color: #2a8fd1; }

/* Layout */
.header {
  background: linear-gradient(120deg, #142a56, #1e3c72 55%, #2a5298);
  color: white;
  padding: 16px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.3px; }
.header h1 a { color: white; text-decoration: none; }

.header-nav { display: flex; gap: 18px; align-items: center; }

.header-nav a {
  color: #cfe0ff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  transition: 0.2s;
}

.header-nav a:hover { color: white; background: rgba(255,255,255,0.12); }
.header-nav span { font-size: 13px; color: #cfe0ff; font-weight: 500; }

.container {
  max-width: 1350px;
  margin: 24px auto;
  padding: 0 20px;
}

.sidebar-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 22px;
  min-height: calc(100vh - 110px);
}

.sidebar {
  background: white;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 2px 14px rgba(20,40,80,0.06);
  align-self: start;
  position: sticky;
  top: 90px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  color: #565b6b;
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  transition: 0.15s;
}

.sidebar a:hover {
  background: #f0f4fb;
  color: #1e3c72;
}

.sidebar a.active {
  background: linear-gradient(120deg, #1e3c72, #2a5298);
  color: white;
  box-shadow: 0 3px 10px rgba(42,82,152,0.3);
}

.main-content {
  background: white;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 2px 14px rgba(20,40,80,0.06);
}

.main-content h2 {
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #1a2540;
  margin-bottom: 18px;
}

.main-content h3 {
  font-weight: 700;
  color: #2b2f38;
  margin: 20px 0 12px;
  font-size: 16px;
}

/* Stats Cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(20,40,80,0.07);
  transition: 0.2s;
  border: 1px solid #eef1f7;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(20,40,80,0.12); }

.stat-card h3 {
  font-size: 30px;
  margin-bottom: 4px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.stat-card p {
  font-size: 12px;
  color: #8a8f9c;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.stat-card.green { border-top: 4px solid #1fa855; }
.stat-card.green h3 { color: #1fa855; }
.stat-card.yellow { border-top: 4px solid #ffc107; }
.stat-card.yellow h3 { color: #e0a800; }
.stat-card.red { border-top: 4px solid #e0394b; }
.stat-card.red h3 { color: #e0394b; }
.stat-card.blue { border-top: 4px solid #2a5298; }
.stat-card.blue h3 { color: #2a5298; }
.stat-card.purple { border-top: 4px solid #6f42c1; }
.stat-card.purple h3 { color: #6f42c1; }

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #eef1f7;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th {
  background: #f7f9fc;
  padding: 13px 12px;
  text-align: left;
  font-weight: 700;
  color: #565b6b;
  border-bottom: 2px solid #eef1f7;
  white-space: nowrap;
}

table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f3f8;
}

table tbody tr { transition: 0.15s; }
table tbody tr:hover { background: #f7f9fc; }

/* Status Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge-green { background: #e3f8ea; color: #14803e; }
.badge-yellow { background: #fff4d6; color: #9c7500; }
.badge-red { background: #fdeced; color: #b12333; }
.badge-active { background: #e3f8ea; color: #14803e; }
.badge-disabled { background: #fdeced; color: #b12333; }

/* Action buttons */
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(15,25,50,0.55);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal.active { display: flex; }

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 14px;
  width: 500px;
  max-width: 90%;
  box-shadow: 0 25px 70px rgba(0,0,0,0.3);
}

.modal-content h3 { margin-bottom: 18px; font-weight: 700; color: #1a2540; }

.modal-close {
  float: right;
  cursor: pointer;
  font-size: 22px;
  color: #8a8f9c;
  line-height: 1;
  transition: 0.15s;
}

.modal-close:hover { color: #e0394b; }

/* Checkbox group */
.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: normal;
  padding: 4px 6px;
  border-radius: 6px;
  transition: 0.15s;
}

.checkbox-group label:hover { background: #f0f4fb; }

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tabs a {
  padding: 9px 18px;
  text-decoration: none;
  color: #565b6b;
  background: #f0f2f7;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: 0.15s;
}

.tabs a:hover { background: #e3e8f2; }

.tabs a.active {
  background: linear-gradient(120deg, #1e3c72, #2a5298);
  color: white;
  box-shadow: 0 3px 10px rgba(42,82,152,0.3);
}

/* Filter bar (search + city dropdown) */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-bar input[type="text"] {
  flex: 2;
  min-width: 220px;
  padding: 11px 14px;
  border: 1.5px solid #e3e6ee;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fbfcfe;
  transition: 0.2s;
}

.filter-bar select {
  flex: 1;
  min-width: 180px;
  padding: 11px 14px;
  border: 1.5px solid #e3e6ee;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fbfcfe url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%232a5298' stroke-width='2' fill='none' fill-rule='evenodd'/></svg>") no-repeat right 14px center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  color: #2b2f38;
}

.filter-bar input[type="text"]:focus,
.filter-bar select:focus {
  outline: none;
  border-color: #2a5298;
  background-color: white;
  box-shadow: 0 0 0 3px rgba(42,82,152,0.12);
}

/* City multi-select dropdown (checkbox based) */
.city-multiselect {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.city-multiselect-btn {
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: 1.5px solid #e3e6ee;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fbfcfe url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%232a5298' stroke-width='2' fill='none' fill-rule='evenodd'/></svg>") no-repeat right 14px center;
  cursor: pointer;
  color: #2b2f38;
  transition: 0.2s;
}

.city-multiselect-btn:hover,
.city-multiselect-btn:focus {
  outline: none;
  border-color: #2a5298;
  background-color: white;
  box-shadow: 0 0 0 3px rgba(42,82,152,0.12);
}

.city-multiselect-btn.active {
  border-color: #2a5298;
  color: #1e3c72;
  font-weight: 600;
}

.city-multiselect-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 280px;
  max-width: 90vw;
  background: white;
  border: 1.5px solid #e3e6ee;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(30,60,114,0.18);
  padding: 12px;
  z-index: 50;
}

.city-multiselect-panel.open { display: block; }

.city-multiselect-search {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #e3e6ee;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 8px;
}

.city-multiselect-actions {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.city-multiselect-actions a {
  color: #2a5298;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.city-multiselect-actions a:hover { text-decoration: underline; }

.city-multiselect-list {
  max-height: 260px;
  overflow-y: auto;
}

.city-multiselect-group {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #8a8f9c;
  margin: 10px 0 4px;
}

.city-multiselect-group:first-child { margin-top: 0; }

.city-multiselect-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: normal;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.city-multiselect-list label:hover { background: #f0f4fb; }

.filter-label {
  font-size: 13px;
  font-weight: 700;
  color: #1e3c72;
  margin-bottom: 8px;
}

.filter-count {
  font-size: 13px;
  color: #8a8f9c;
  margin-bottom: 14px;
  font-weight: 500;
}

/* Tender cards (shared across dashboard / tenders / saved) */
.tender-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; margin-top: 5px; }

.tender-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(20,40,80,0.07);
  border-left: 5px solid #2a5298;
  border-top: 1px solid #eef1f7;
  border-right: 1px solid #eef1f7;
  border-bottom: 1px solid #eef1f7;
  transition: 0.25s;
}

.tender-card:hover { box-shadow: 0 10px 28px rgba(20,40,80,0.15); transform: translateY(-2px); }
.tender-card.status-green { border-left-color: #1fa855; }
.tender-card.status-yellow { border-left-color: #ffc107; }
.tender-card.status-red { border-left-color: #e0394b; }

.tender-card h3 { font-size: 17px; margin-bottom: 8px; color: #1a2540; font-weight: 700; line-height: 1.3; }
.tender-card .tender-id { font-size: 11px; color: #9a9fab; margin-bottom: 10px; font-weight: 500; }
.tender-card .description { font-size: 13px; color: #5b5f6c; margin-bottom: 15px; line-height: 1.55; max-height: 60px; overflow: hidden; }
.tender-card .info-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; font-size: 12px; }
.tender-card .info-tag { background: #f0f4fb; padding: 5px 11px; border-radius: 6px; color: #45495a; font-weight: 500; }
.tender-card .info-tag strong { color: #1e3c72; }
.tender-card .card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tender-card .card-actions .btn { font-size: 12px; padding: 7px 14px; }

.no-tenders {
  text-align: center;
  padding: 70px 20px;
  color: #9a9fab;
  font-size: 15px;
}

.no-tenders .no-tenders-icon { font-size: 42px; display: block; margin-bottom: 12px; }

/* Legacy support: pages that still reference the old standalone .search-bar */
.search-bar { margin-bottom: 15px; }
.search-bar input { width: 100%; padding: 11px 14px; border: 1.5px solid #e3e6ee; border-radius: 8px; font-size: 14px; font-family: inherit; background: #fbfcfe; }
.search-bar input:focus { outline: none; border-color: #2a5298; background: white; box-shadow: 0 0 0 3px rgba(42,82,152,0.12); }

.export-bar { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }

/* ============================================================
   Responsive — designed to work cleanly on phones, tablets, and
   desktop. Breakpoints: 1024px (tablet), 768px (small tablet /
   large phone), 480px (phone).
   ============================================================ */

/* Global safety nets that help at every size */
img, svg { max-width: 100%; }
table { table-layout: auto; }

/* ---- Tablet (<=1024px): tighten spacing, sidebar stays but narrower ---- */
@media (max-width: 1024px) {
  .container { padding: 0 16px; }
  .sidebar-layout { grid-template-columns: 190px 1fr; gap: 16px; }
  .tender-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .stats-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* ---- Small tablet / large phone (<=768px) ---- */
@media (max-width: 768px) {
  .container { margin: 14px auto; padding: 0 12px; }

  /* Header: allow wrapping instead of overflowing on narrow screens */
  .header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .header h1 { font-size: 18px; }
  .header-nav { gap: 10px; flex-wrap: wrap; }
  .header-nav span { display: block; width: 100%; font-size: 12px; }

  /* Sidebar becomes a horizontal scrollable pill bar above the content */
  .sidebar-layout { grid-template-columns: 1fr; gap: 14px; min-height: auto; }
  .sidebar {
    position: static;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 10px;
    white-space: nowrap;
  }
  .sidebar a {
    margin-bottom: 0;
    flex: 0 0 auto;
    padding: 9px 12px;
    font-size: 13px;
  }

  .main-content { padding: 18px; }

  .login-container { width: 92%; padding: 32px 24px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card h3 { font-size: 24px; }

  .filter-bar input[type="text"],
  .filter-bar select,
  .filter-bar .city-multiselect { flex: 1 1 100%; min-width: 0; }

  .tender-cards { grid-template-columns: 1fr; gap: 14px; }

  .checkbox-group { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

  .modal-content { padding: 20px; width: 92%; }

  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .tabs a { flex: 0 0 auto; white-space: nowrap; }
}

/* ---- Phone (<=480px) ---- */
@media (max-width: 480px) {
  .header h1 { font-size: 16px; }
  .header-nav a { padding: 6px 10px; font-size: 13px; }

  .main-content { padding: 14px; border-radius: 10px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card h3 { font-size: 20px; }
  .stat-card p { font-size: 10px; }

  .btn { padding: 9px 14px; font-size: 13px; }
  .btn-sm { padding: 6px 10px; font-size: 11px; }

  /* Row-level action buttons stack vertically so they never overflow
     a narrow table cell */
  .actions { flex-direction: column; align-items: stretch; }
  .actions form, .actions .btn { width: 100%; }
  .actions form button { width: 100%; }

  .card-actions { flex-direction: column; align-items: stretch; }
  .card-actions .btn, .card-actions a.btn { width: 100%; text-align: center; }

  table { font-size: 12px; }
  table th, table td { padding: 8px 8px; }

  .tender-card { padding: 16px; }
  .tender-card h3 { font-size: 15px; }

  .login-container { padding: 26px 18px; }
  .login-container h2 { font-size: 20px; }

  .modal-content { padding: 16px; }

  .checkbox-group { grid-template-columns: 1fr 1fr; }

  /* Forms that put a file input + button side by side need to stack */
  form[style*="display:flex"] { flex-wrap: wrap; }
}

/* Very small phones */
@media (max-width: 360px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .checkbox-group { grid-template-columns: 1fr; }
}
