/* assets/styles.css
   Pristine theme (dark grey + green accents)
   Cleaned & organized (no duplicates)
*/

/* ----------------- Base ----------------- */
body {
  background: #f5f6f7;
  color: #222;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}
body.bg-light { background: #f6f7f8; color: #222; }

/* ----------------- Navbar ----------------- */
.navbar { background: #2d3436 !important; }
.navbar .navbar-brand,
.navbar .nav-link,
.navbar .btn { color: #ecf0f1 !important; }
.navbar .nav-link.active { font-weight: 600; text-decoration: underline; }

/* ----------------- Buttons ----------------- */
.btn-primary {
  background-color: #16a085;
  border-color: #138a72;
  color: #fff;
  border-radius: 8px;
}
.btn-primary:hover { background-color: #138a72; border-color: #0f6f5c; }
.btn-success { background-color: #27ae60; border-color: #1e874b; color: #fff; }
.modal .btn-danger { background:#d9534f; border-color:#d43f3a; }

/* ----------------- Inputs ----------------- */
.form-control, .form-select {
  border-radius: 6px;
  border: 1px solid #dfe6e9;
}

/* ----------------- Cards ----------------- */
.card {
  border-radius: 12px;
  background: #fff;
}
.card h4 { font-weight: 700; color: #2d3436; }
.card.p-3 {
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(20,20,20,0.03);
  background:#fff;
  color:#222;
}

/* ----------------- Tables ----------------- */
.table { border-collapse: separate; border-spacing: 0 6px; background: transparent; }
.table thead th {
  background: transparent;
  border: 0;
  color: #444;
  font-weight: 600;
  text-align: left;
  vertical-align: middle;
  padding: .85rem .75rem;
}
.table tbody tr { background: #fff; border-radius: 6px; }
.table tbody tr + tr td { border-top: 1px solid #f0f0f0; }
.table tbody td { vertical-align: middle; padding: .65rem .75rem; color:#333; }
.table-responsive { overflow-x: auto; }

/* Column widths/alignment */
.table thead th:nth-child(1), .table tbody td:nth-child(1) { width: 55px; text-align: center; }
.table thead th:nth-child(2), .table tbody td:nth-child(2) { width: 240px; }
.table thead th:nth-child(3), .table tbody td:nth-child(3) { width: 140px; }
.table thead th:nth-child(4), .table tbody td:nth-child(4) { max-width: 520px; word-break: break-word; }
.table thead th:nth-child(6), .table tbody td:nth-child(6),
.table thead th:nth-child(7), .table tbody td:nth-child(7),
.table thead th:nth-child(8), .table tbody td:nth-child(8) { text-align: center; }

/* ----------------- Dashboard ----------------- */
.container {
  max-width: 1200px;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 18px;
  padding-right: 18px;
}

.dashboard-stats {
  display:flex; gap:20px; align-items:stretch; margin-bottom:18px; flex-wrap:wrap;
}
.dashboard-stats .col-md-3 {
  display:flex; flex:1 1 0; padding-left:.5rem; padding-right:.5rem; min-width:200px;
}
.dashboard-stats .col-md-3 .card {
  flex:1; border-radius:10px; box-shadow: 0 1px 6px rgba(20,20,20,0.03);
  padding:18px; display:flex; flex-direction:column; justify-content:center;
}
.dashboard-stats .card small { color:#666; display:block; margin-bottom:8px; }
.dashboard-stats .card h4 { margin:0; font-size:28px; color:#111; }

/* Stat-card headers (colors) */
.stat-card { overflow:hidden; border-radius:10px; }
.stat-header { padding:10px 14px; color:#fff; font-weight:600; }
.stat-instagram { background: linear-gradient(90deg,#f58529,#dd2a7b); }
.stat-facebook { background: linear-gradient(90deg,#1877f2,#4267b2); }
.stat-tiktok { background: linear-gradient(90deg,#010101,#69c9d0); }
.stat-all { background: linear-gradient(90deg,#6c757d,#343a40); }

/* ----------------- Priority Colors ----------------- */
.priority-Normal { color: #27ae60; font-weight: 600; }
.priority-Medium { color: #e67e22; font-weight: 600; }
.priority-Critical { color: #c0392b; font-weight: 600; }

/* ----------------- Status Badges ----------------- */
.badge-status-Processing { background:#aed6f1; color:#154360; padding:2px 6px; display:inline-block; font-weight:600; }
.badge-status-Pending { background:#f9e79f; color:#7d6608; border-radius:6px; padding:.25rem .5rem; font-weight:600; display:inline-block; }
.badge-status-Completed { background:#abebc6; color:#145a32; border-radius:6px; padding:.25rem .5rem; font-weight:600; display:inline-block; }
.badge-status-Cancelled { background:#f5b7b1; color:#78281f; border-radius:6px; padding:.25rem .5rem; font-weight:600; display:inline-block; }

/* ----------------- Responsive ----------------- */
@media (max-width: 768px) {
  .dashboard-stats { flex-direction: column; }
  .dashboard-stats .col-md-3 { width:100%; padding-left:0; padding-right:0; }
  .navbar .d-flex { display: none; }
  .table thead { display: none; }
  .table tbody td { display: block; width: 100%; font-size: 13px; padding: .5rem .6rem; }
  .table tbody tr { margin-bottom: 12px; display:block; padding:10px; }
  .table thead th { font-size: 12px; }
}

/* ----------------- Requests Table (URL + Actions) ----------------- */
.table-responsive table { width: 100% !important; table-layout: fixed !important; }

.table.table-sm td.url-col,
.table.table-sm th.url-col {
  max-width: 360px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: top !important;
}
.table.table-sm td.url-col:hover {
  overflow: visible !important;
  white-space: normal !important;
  background: #fff !important;
  position: relative !important;
  z-index: 10 !important;
}
.table.table-sm td.url-col a {
  display:inline-block; width:100%;
  overflow:hidden; text-overflow:ellipsis;
  white-space:nowrap; color:#0d6efd; text-decoration:underline;
}
.table.table-sm td.action-col { white-space:nowrap !important; vertical-align:middle !important; }
.table.table-sm td.action-col .form-control-sm,
.table.table-sm td.action-col .form-select-sm {
  height: calc(1.5em + .5rem) !important;
  padding: .25rem .35rem !important;
  font-size: .82rem !important;
}
.table.table-sm td.action-col input[type="datetime-local"] {
  min-width:160px !important; max-width:240px !important;
}
.table.table-sm td.action-col select.form-select-sm {
  min-width:90px !important; max-width:140px !important;
}

/* === FIXED NAVBAR + RESPONSIVE DASHBOARD === */

/* Push content down so it does not hide behind navbar */
body {
  padding-top: 70px; /* adjust if your navbar is taller/shorter */
}

/* Ensure dashboard stats adapt well */
@media (max-width: 992px) {
  .dashboard-stats {
    flex-direction: column;
  }
  .dashboard-stats .col-md-3 {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }
}

/* Improve table scroll on mobile */
@media (max-width: 768px) {
  .table-responsive {
    overflow-x: auto;
  }
  .table thead {
    display: none;
  }
  .table tbody td {
    display: block;
    width: 100%;
    font-size: 13px;
    padding: .5rem .6rem;
  }
  .table tbody tr {
    margin-bottom: 12px;
    display: block;
    padding: 10px;
  }
}

/* =========================
   Fixed navbar + reliable mobile behavior patch
   Paste this at the end of assets/styles.css
   ========================= */

/* header height variable — adjust if needed */
:root {
  --header-height-desktop: 64px;
  --header-height-tablet: 64px;
  --header-height-mobile: 56px;
}

/* Ensure navbar is fixed and spans full width */
.navbar.fixed-top,
.navbar {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1030; /* bootstrap default layering */
}

/* Use CSS variable for page top padding so content is not hidden */
@media (min-width: 993px) {
  body { padding-top: var(--header-height-desktop); }
}
@media (min-width: 768px) and (max-width: 992px) {
  body { padding-top: var(--header-height-tablet); }
}
@media (max-width: 767px) {
  body { padding-top: var(--header-height-mobile); }
}

/* Keep the bootstrap container fluid below the fixed nav if used */
.container, .container-fluid {
  max-width: 1200px;
}

/* Fix: do NOT completely hide the right side .d-flex on small screens.
   Instead allow it to wrap so logout button and greeting are available in the collapse. */
@media (max-width: 768px) {
  .navbar .d-flex {
    display: flex !important;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }

  /* Ensure navbar toggler is visible and not covered */
  .navbar-toggler {
    z-index: 1040;
  }

  /* Better spacing for collapsed menu contents */
  .navbar-collapse {
    padding: 10px 0;
  }

  /* Dashboard stats stack vertically and remove horizontal overflow */
  .dashboard-stats {
    flex-direction: column;
    gap: 14px;
  }
  .dashboard-stats .col-md-3 {
    padding-left: 0;
    padding-right: 0;
    min-width: 0;
  }

  /* Table responsive: keep horizontal scroll but make rows readable */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table thead { display: none; } /* hide header on very small */
  .table tbody td {
    display: block;
    width: 100%;
    padding: .65rem .75rem;
    white-space: normal;
    word-break: break-word;
  }
  .table tbody tr {
    display: block;
    margin-bottom: 12px;
    background: #fff;
    padding: 10px;
    border-radius: 6px;
  }
}

/* Tablet specific: ensure stats grid uses two columns if space */
@media (min-width: 768px) and (max-width: 992px) {
  .dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .dashboard-stats .col-md-3 { padding: 0; }
}

/* Small niceties for long URLs inside table */
.table tbody td[style*="max-width"] {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Prevent accidental horizontal scroll of whole page */
html, body { overflow-x: hidden; }

/* If the brand or toggler overlap, add small left padding so icon isn't flush to edge on mobile */
.navbar .navbar-brand {
  padding-left: 12px;
}
.navbar .navbar-toggler {
  margin-right: 12px;
}

/* If you need a slightly taller header on desktop adjust the var at top */

/* ---------- Login page centering (used by index.php & user_login.php) ---------- */
.login-wrapper {
  min-height: 80vh;                 /* center vertically while leaving a bit of top space */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 24px rgba(15, 15, 15, 0.06);
  border-radius: 8px;
}

.login-card .card-body { padding: 18px 20px; }

/* small screens: slightly smaller card and padding */
@media (max-width: 420px) {
  .login-wrapper { min-height: 72vh; padding: 16px; }
  .login-card { max-width: 340px; }
  .login-card .card-body { padding: 14px; }
}

/* ensure no gap from top iOS safe-area */
html, body { -webkit-text-size-adjust: 100%; }

/* optional: show error message styling */
.login-error {
  color: #8a1f1f;
  background: #ffe9e9;
  border: 1px solid rgba(138,31,31,0.12);
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.95rem;
}

    /* small local adjustments */
    .form-label { font-weight: 600; }
    .service-qty-row { display:flex; gap:12px; align-items:center; }
    .service-qty-row .form-select { flex:1; }
    .service-qty-row .form-control { width:160px; max-width:40%; min-width:120px; }

    /* clickable url style */
    .request-link { color: #0d6efd; text-decoration: underline; }

    /* priority badge colors */
    .badge-priority-Normal {
      background: #fff3cd;
      color: #7a5a00;
      border-radius: 6px;
      padding: 6px 10px;
      font-weight: 600;
      display: inline-block;
    }
    .badge-priority-Medium {
      background: #ffe8a1;
      color: #6b4b00;
      border-radius: 6px;
      padding: 6px 10px;
      font-weight: 600;
      display: inline-block;
    }
    .badge-priority-Critical {
      background: #f8d7da;
      color: #842029;
      border-radius: 6px;
      padding: 6px 10px;
      font-weight: 600;
      display: inline-block;
    }

    @media (max-width: 576px) {
      .service-qty-row { flex-direction:column; align-items:stretch; }
      .service-qty-row .form-control { width:100%; max-width:100%; }
    }
  
    .page-title { margin: 20px 0 12px; }
    .filter-row { gap:10px; align-items:center; margin-bottom:12px; }

    /* Priority colors (square labels) */
    .priority-Normal { background:#f9e79f; color:#7d6608; padding:2px 6px; font-weight:600; display:inline-block; }
    .priority-Medium { background:#f8c471; color:#7e5109; padding:2px 6px; font-weight:600; display:inline-block; }
    .priority-Critical { background:#f1948a; color:#78281f; padding:2px 6px; font-weight:700; display:inline-block; }

    /* Status square badges */
    .badge-status-Processing { background:#aed6f1; color:#154360; padding:2px 6px; display:inline-block; font-weight:600; }
    .badge-status-Pending { background:#f9e79f; color:#7d6608; padding:2px 6px; display:inline-block; font-weight:600; }
    .badge-status-Completed { background:#abebc6; color:#145a32; padding:2px 6px; display:inline-block; font-weight:600; }
    .badge-status-Cancelled { background:#f5b7b1; color:#78281f; padding:2px 6px; display:inline-block; font-weight:600; }

    th { text-align:center; }
    td.text-center { text-align:center; }

