/* ==========================================================================
   PICK SALON - Admin Console Design System (Dark Sport-Tech & Glassmorphism)
   ========================================================================== */

:root {
  --bg-base: #070d12;
  --bg-surface: #0c151d;
  --bg-elevated: #111d27;
  --bg-card: rgba(17, 29, 39, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active: rgba(16, 185, 129, 0.4);

  --mint: #10b981;
  --mint-glow: rgba(16, 185, 129, 0.25);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.25);
  --amber: #f59e0b;
  --rose: #f43f5e;
  --purple: #8b5cf6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --sidebar-w: 260px;
  --header-h: 64px;
  --font-family: 'Noto Sans KR', 'Inter', -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Noto Sans KR', sans-serif;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ── Login Gate Container ── */
#adminAuthGate {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, #112230 0%, #070d12 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  text-align: center;
  backdrop-blur: 16px;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.login-logo .pk-badge {
  width: 38px;
  height: 38px;
  background: var(--mint);
  color: #000;
  font-family: var(--font-heading), 'Inter', sans-serif;
  font-weight: 900;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  line-height: 1;
}

.login-logo h1 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.login-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 26px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--mint);
  box-shadow: 0 0 14px var(--mint-glow);
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--mint);
  color: #000;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: #0ea371;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--mint-glow);
}

/* ── App Shell Layout ── */
#adminAppShell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-glass);
}

.sidebar-header .pk-badge {
  width: 32px;
  height: 32px;
  background: var(--mint);
  color: #000;
  font-family: var(--font-heading), 'Inter', sans-serif;
  font-weight: 900;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  line-height: 1;
}

.sidebar-header h2 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-header .admin-badge {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--mint);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  margin-left: auto;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.nav-item i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  color: var(--text-dim);
  transition: color 0.15s;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: #fff;
}

.nav-item:hover i {
  color: var(--mint);
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.12);
  color: var(--mint);
  font-weight: 800;
  border-color: var(--border-active);
}

.nav-item.active i {
  color: var(--mint);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--mint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--mint);
}

.admin-info .name {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
}

.admin-info .role {
  font-size: 10.5px;
  color: var(--text-dim);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--rose);
}

/* Main Area */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.topbar-breadcrumb {
  font-size: 12px;
  color: var(--text-dim);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-site-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-site-link:hover {
  color: var(--mint);
  border-color: var(--mint);
}

/* Content Container */
.admin-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ── UI Components inside Views ── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-title-group h2 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.view-title-group p {
  font-size: 12.5px;
  color: var(--text-muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--mint);
}

.stat-card.amber::before { background: var(--amber); }
.stat-card.cyan::before { background: var(--cyan); }
.stat-card.purple::before { background: var(--purple); }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-icon {
  font-size: 16px;
  color: var(--text-dim);
}

.stat-value {
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  font-family: var(--font-heading);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* Card & Table */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-dim);
  font-weight: 700;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.02);
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-main);
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-state i {
  font-size: 36px;
  margin-bottom: 12px;
  display: block;
}

.empty-state p {
  font-size: 13px;
  font-weight: 600;
}

/* Loading Spinner */
.loading-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Mobile Sidebar Drawer & Backdrop ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.sidebar-backdrop.open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.btn-sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  padding: 6px;
  cursor: pointer;
  margin-left: auto;
  line-height: 1;
  transition: color 0.15s;
}

.btn-sidebar-close:hover {
  color: #fff;
}

#mobileSidebarToggle {
  display: none;
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Optimization
   ========================================================================== */

@media (max-width: 900px) {
  #mobileSidebarToggle {
    display: inline-flex !important;
    padding: 8px 10px;
    font-size: 15px;
  }

  .btn-sidebar-close {
    display: flex;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .admin-sidebar.open {
    transform: translateX(280px);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.85);
  }

  .admin-topbar {
    padding: 0 14px;
    height: 56px;
  }

  .topbar-left {
    gap: 10px;
  }

  .topbar-title {
    font-size: 14.5px;
  }

  .topbar-breadcrumb {
    font-size: 11px;
  }

  .admin-content {
    padding: 16px 14px;
  }
}

@media (max-width: 768px) {
  .admin-content {
    padding: 12px 10px;
  }

  .view-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 16px;
  }

  .view-header .btn-primary {
    width: 100% !important;
    justify-content: center;
  }

  .view-title-group h2 {
    font-size: 17px;
  }

  .view-title-group p {
    font-size: 11.5px;
    line-height: 1.45;
  }

  .card {
    padding: 14px 12px;
    border-radius: 12px;
    margin-bottom: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .card-title {
    font-size: 13.5px;
    margin-bottom: 10px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px 14px;
    border-radius: 10px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-sub {
    font-size: 10px;
  }

  /* Tables horizontal scroll */
  .admin-table {
    min-width: 520px;
    font-size: 12px;
  }

  .admin-table th, .admin-table td {
    padding: 8px 10px;
    white-space: nowrap;
  }

  /* Automatically stack any multi-column grid into single column on mobile */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Subnavs scroll horizontally without wrapping into many rows */
  .settings-subnav, [style*="display:flex"][style*="gap:8px"] {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .stab-btn, .analytics-tab-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 7px 12px !important;
    font-size: 12px !important;
  }

  .login-card {
    padding: 26px 18px;
    border-radius: 16px;
  }

  .login-title {
    font-size: 16px;
  }

  .login-subtitle {
    font-size: 11.5px;
    margin-bottom: 20px;
  }
}

@media (max-width: 768px) {
  .topbar-search-container {
    max-width: 200px !important;
  }
}

@media (max-width: 540px) {
  .topbar-search-container {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .topbar-breadcrumb {
    display: none;
  }

  .topbar-btn-text {
    display: none;
  }

  .topbar-right {
    gap: 6px;
  }

  .topbar-right .btn-site-link {
    padding: 6px 8px;
  }

  .stat-grid {
    grid-template-columns: 1fr !important;
  }
}
