/* ============================================================
   Admin Panel Stylesheet - Complete Clean Version
   ============================================================ */

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

:root {
  --sidebar-bg:  #0a0f14;
  --sidebar-w:   260px;
  --main-bg:     #0f1923;
  --card-bg:     #162230;
  --card-border: rgba(255,255,255,.07);
  --accent:      #00b4d8;
  --accent-dim:  rgba(0,180,216,.12);
  --text:        #e8f0f5;
  --text-dim:    rgba(232,240,245,.5);
  --text-muted:  rgba(232,240,245,.3);
  --success:     #22c55e;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --font:        'Outfit', system-ui, sans-serif;
  --r:           12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--main-bg);
  color: var(--text);
  display: flex;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
button { font-family: var(--font); }

/* ---- SIDEBAR ---- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,.05);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 28px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.sidebar-brand-name { font-size: 17px; font-weight: 700; color: #fff; line-height: 1; }
.sidebar-brand-sub  { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-top: 4px; }
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-section-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 8px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  transition: all .2s;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
}
.sidebar-link:hover  { background: rgba(255,255,255,.06); color: var(--text); }
.sidebar-link.active { background: var(--accent-dim); color: var(--accent); }
.sidebar-link .icon  { font-size: 16px; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px 12px 20px;
  border-top: 1px solid rgba(255,255,255,.05);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(0,180,216,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
}
.sidebar-username { font-size: 14px; font-weight: 600; }
.sidebar-role     { font-size: 11px; color: var(--text-muted); }

/* ---- MAIN ---- */
.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  padding: 20px 28px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(10,15,20,.5);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title    { font-size: 18px; font-weight: 600; }
.topbar-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
.topbar-actions  { display: flex; align-items: center; gap: 10px; }
.admin-content   { padding: 28px; flex: 1; }

/* ---- STATS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.stat-value { font-size: 32px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 12px; color: var(--text-muted); letter-spacing: .5px; }

/* ---- TABLE ---- */
.data-table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  /* NOTE: no overflow:hidden here so dropdowns are not clipped */
}
.table-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-radius: var(--r) var(--r) 0 0;
  background: var(--card-bg);
}
.table-title { font-size: 15px; font-weight: 600; }
.table-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.1);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  display: inline-block;
}
.filter-btn:hover  { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(0,180,216,.3); }

.search-wrap { position: relative; }
.search-wrap input {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 8px 14px 8px 36px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  width: 220px;
  transition: all .2s;
}
.search-wrap input:focus { outline: none; border-color: var(--accent); }
.search-wrap::before {
  content: '⌕';
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 22px;
  border-bottom: 1px solid var(--card-border);
  background: var(--card-bg);
}
.data-table td {
  padding: 14px 22px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,.03);
  vertical-align: middle;
  background: var(--card-bg);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.data-table .client-name { font-weight: 600; color: #fff; }
.data-table .client-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- STATUS BADGES ---- */
.status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.status-pending     { background: rgba(245,158,11,.1);  color: #fbbf24; }
.status-pending::before     { background: #fbbf24; }
.status-confirmed   { background: rgba(34,197,94,.1);   color: #4ade80; }
.status-confirmed::before   { background: #4ade80; }
.status-in_progress { background: rgba(0,180,216,.1);   color: var(--accent); }
.status-in_progress::before { background: var(--accent); }
.status-completed   { background: rgba(255,255,255,.06); color: var(--text-dim); }
.status-completed::before   { background: var(--text-dim); }
.status-cancelled   { background: rgba(239,68,68,.1);   color: #f87171; }
.status-cancelled::before   { background: #f87171; }

/* ---- GENERAL ACTION BUTTONS ---- */
.action-btn {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
}
.action-btn-primary { background: var(--accent); color: #050c14; }
.action-btn-primary:hover { background: #38d1e8; }
.action-btn-success { background: rgba(34,197,94,.15); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.action-btn-success:hover { background: rgba(34,197,94,.25); }
.action-btn-ghost   { background: rgba(255,255,255,.05); color: var(--text-dim); border: 1px solid rgba(255,255,255,.08); }
.action-btn-ghost:hover { background: rgba(255,255,255,.1); color: var(--text); }
.action-btn-danger  { background: rgba(239,68,68,.1); color: #f87171; border: 1px solid rgba(239,68,68,.15); }
.action-btn-danger:hover { background: rgba(239,68,68,.2); }

/* ---- ACTION MENU (three dots dropdown) ---- */
.action-menu-wrap {
  position: relative;
  display: inline-block;
}
.action-menu-btn {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  width: 44px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  letter-spacing: 2px;
  line-height: 0;
  padding: 0 0 6px 0;
  font-family: var(--font);
}
.action-menu-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.action-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #1c3348;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  min-width: 215px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  z-index: 9999;
  flex-direction: column;
  overflow: hidden;
}
.action-menu-dropdown.open { display: flex; }
.action-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  color: rgba(232,240,245,.7);
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,.06);
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.action-menu-item:last-child      { border-bottom: none; }
.action-menu-item:hover           { background: rgba(255,255,255,.07); color: #fff; }
.action-menu-item-primary         { color: var(--accent); }
.action-menu-item-primary:hover   { background: rgba(0,180,216,.15); }
.action-menu-item-success         { color: #4ade80; }
.action-menu-item-success:hover   { background: rgba(34,197,94,.12); }
.action-menu-item-warning         { color: #fbbf24; }
.action-menu-item-warning:hover   { background: rgba(251,191,36,.1); }
.action-menu-item-done            { color: #4ade80; }
.action-menu-item-done:hover      { background: rgba(34,197,94,.12); }
.action-menu-item-start           { color: var(--accent); }
.action-menu-item-start:hover     { background: rgba(0,180,216,.15); }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.modal-sub   { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.modal-close {
  position: absolute;
  top: 20px; right: 20px;
  background: rgba(255,255,255,.07);
  border: none;
  border-radius: 6px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
  transition: all .2s;
}
.modal-close:hover { background: rgba(255,255,255,.14); color: #fff; }

/* ---- BLOCK DATES ---- */
.block-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.block-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.12);
  border-radius: 8px;
  padding: 10px 14px;
  gap: 12px;
}
.block-item-date   { font-weight: 600; font-size: 14px; }
.block-item-time   { font-size: 12px; color: var(--text-muted); }
.block-item-reason { font-size: 12px; color: var(--text-dim); }

/* ---- OFFLINE BANNER ---- */
.offline-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--r);
  padding: 12px 20px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #fcd34d;
}
.offline-banner.visible { display: flex; }

/* ---- CONNECTIVITY DOT ---- */
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.conn-dot.online  { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,.5); }
.conn-dot.offline { background: var(--danger); animation: pulse-dot 1.5s infinite; }
@keyframes pulse-dot { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* ---- ALERTS ---- */
.alert {
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.25);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.25);  color: #86efac; }
.alert-info    { background: rgba(0,180,216,.1);  border: 1px solid rgba(0,180,216,.25);  color: #90e0ef; }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: #fcd34d; }

/* ---- FORM ELEMENTS ---- */
.admin-input {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  width: 100%;
  transition: border-color .2s;
}
.admin-input:focus { outline: none; border-color: var(--accent); }
.admin-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.admin-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---- DETAIL GRID ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-key  { font-size: 11px; letter-spacing: .5px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 3px; }
.detail-val  { font-size: 14px; font-weight: 500; }

/* ---- QUOTE BREAKDOWN ---- */
.quote-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: 14px;
}
.quote-line:last-child { border: none; }
.quote-total {
  background: var(--accent-dim);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}
.quote-total-label  { font-weight: 600; }
.quote-total-amount { font-size: 24px; font-weight: 700; color: var(--accent); }

/* ---- SPINNER ---- */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-sidebar.mobile-open {
    display: flex;
    position: fixed;
    inset: 0;
    width: 100%;
    z-index: 500;
    overflow-y: auto;
  }
  .admin-content  { padding: 12px; }
  .stats-grid     { grid-template-columns: 1fr 1fr; }
  .admin-topbar   { padding: 12px 14px; }
  .data-table th:nth-child(3),
  .data-table td:nth-child(3),
  .data-table th:nth-child(4),
  .data-table td:nth-child(4) { display: none; }
  .action-menu-dropdown { min-width: 230px; right: 0; }
  .action-menu-item { padding: 16px 20px; font-size: 15px; }
}
@media (max-width: 480px) {
  .stats-grid     { grid-template-columns: 1fr; }
  .admin-form-row { grid-template-columns: 1fr; }
  .detail-grid    { grid-template-columns: 1fr; }
  .data-table th:nth-child(2),
  .data-table td:nth-child(2) { display: none; }
}
