/* ============================================================
   Bustabit Admin Dashboard — Dark Theme
   Replaces: ui.css, style.css, ssm.css, bootstrap-vertical-menu.css
   Used with: Bootstrap 5.3 (data-bs-theme="dark")
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --admin-bg: #1a1d23;
  --admin-surface: #21252b;
  --admin-surface-2: #282c34;
  --admin-border: #373b44;
  --admin-text: #c9d1d9;
  --admin-text-muted: #8b949e;
  --admin-accent: #58a6ff;
  --admin-accent-hover: #79b8ff;
  --admin-success: #3fb950;
  --admin-danger: #f85149;
  --admin-warning: #d29922;
  --admin-sidebar-width: 200px;
  --admin-header-height: 56px;
}

/* --- Base --- */
html, body {
  font-size: 13px;
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--admin-bg);
  color: var(--admin-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* --- Links --- */
a { color: var(--admin-accent); text-decoration: none; }
a:hover { color: var(--admin-accent-hover); }
a:visited { color: var(--admin-accent); }
a:link { color: var(--admin-accent); }
a.userlist:link, a.userlist:visited { color: #f4ff61; }

/* --- Sidebar --- */
#admin-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--admin-sidebar-width);
  height: 100vh;
  background: var(--admin-surface);
  border-right: 1px solid var(--admin-border);
  z-index: 1030;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s ease;
}

#admin-sidebar .sidebar-brand {
  padding: 1rem 1.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--admin-accent);
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

#admin-sidebar .sidebar-section {
  padding: 0.75rem 1.25rem 0.35rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--admin-text-muted);
  font-weight: 600;
}

#admin-sidebar .nav-link {
  color: var(--admin-text-muted);
  padding: 0.55rem 1.25rem;
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}
#admin-sidebar .nav-link:hover {
  color: var(--admin-text);
  background: var(--admin-surface-2);
  border-left-color: var(--admin-border);
}
#admin-sidebar .nav-link.active {
  color: var(--admin-accent);
  background: rgba(88, 166, 255, 0.08);
  border-left-color: var(--admin-accent);
}
#admin-sidebar .nav-link i { font-size: 1rem; width: 20px; text-align: center; }

/* --- Header --- */
#header-container {
  position: fixed;
  top: 0;
  left: var(--admin-sidebar-width);
  right: 0;
  height: var(--admin-header-height);
  background: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
  z-index: 1020;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
}
#header-container h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: var(--admin-text);
  white-space: nowrap;
}

/* Legacy header elements (hidden, no longer used with new layout) */
#header-container-no-top { display: none; }

/* --- Main Content --- */
#blog-container {
  margin-top: calc(var(--admin-header-height) + 16px);
  margin-left: var(--admin-sidebar-width);
  margin-bottom: 30px;
  padding: 0 1rem 1rem 0.5rem;
  min-height: calc(100vh - var(--admin-header-height));
}

#blog-container-no-top {
  max-width: 420px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* --- Admin Card (replaces ul[data-role='listview']) --- */
.admin-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.admin-card label,
label.form-label {
  color: var(--admin-text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

/* --- Tables (from style.css + ssm.css) --- */
table { padding: 2px; color: var(--admin-text); }
td { font-size: 9pt; padding: 3px 4px; line-height: 18px; }
th {
  font-size: 10pt;
  padding: 6px 4px;
  background-color: var(--admin-surface-2);
  font-weight: 600;
  text-align: center;
  color: var(--admin-text);
}
th a:link, th a:visited { color: var(--admin-accent); }

/* ssm.css table classes */
.table_main { width: 100%; font-weight: bold; font-size: 12px; border-spacing: 0; }
.title { background: var(--admin-surface-2); color: var(--admin-text); height: 35px; text-align: center; }
.tr { height: 35px; background: var(--admin-surface); border-bottom: 1px solid var(--admin-border); }
.num_td { width: 8%; }
.num_b_td { width: 8%; font-weight: bold; }
.num_input { width: 80%; text-align: center; }

/* Text alignment */
.txt_center { text-align: center; vertical-align: middle; }
.txt_left { text-align: left; vertical-align: middle; }
td.txt_right, th.txt_right { text-align: right; vertical-align: middle; }
th.txt_center { text-align: center; padding: 2px 4px; vertical-align: middle !important; }
td.txt_center { text-align: center; padding: 2px 4px; vertical-align: middle; }
td.txt_left { text-align: left; padding: 2px 4px; vertical-align: middle; }

/* Highlight */
td.special { background-color: rgba(255, 255, 0, 0.12); }

/* Table borders */
.table_noborder td, .table_noborder th {
  border: 1px solid var(--admin-border) !important;
}
.table_noborder2 td, .table_noborder2 th {
  border: 0 !important;
}

/* Table row hover */
.mytable { font-weight: normal; cursor: pointer; }
.mytable:hover { background-color: rgba(88, 166, 255, 0.1); }

/* 업체 페이지 상단 서브메뉴 탭바 */
.company-subnav {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.company-subnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  color: var(--admin-text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  min-width: 90px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.company-subnav-item i {
  font-size: 1.4rem;
}
.company-subnav-item:hover {
  background: rgba(88, 166, 255, 0.15);
  color: var(--admin-accent);
  text-decoration: none;
}

/* 정렬 가능한 테이블 헤더 */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover {
  background-color: rgba(88, 166, 255, 0.12);
}
th.sortable .sort-inactive {
  opacity: 0.35;
}

/* Company rows — mem_stat 기반 행 색상 */
tr.company { background-color: var(--admin-surface-2); color: var(--admin-text); }
tr.company:hover { background-color: rgba(88, 166, 255, 0.12) !important; }
tr.company_block { background-color: rgba(248, 81, 73, 0.35) !important; color: #ffb3b0 !important; }
tr.company_block td { color: #ffb3b0 !important; }
tr.company_block:hover { background-color: rgba(248, 81, 73, 0.48) !important; }

/* Mobile table */
tr.mobile {}
th.mobile { text-align: center; padding: 4px; width: 15%; }
td.mobile { padding: 4px; width: 35%; }

/* --- Member Type Colors (from style.css) --- */
.member1 { background-color: #444; }
.member1:hover { background-color: rgba(88, 166, 255, 0.3); }
.member1 a:link, .member1 a:visited { color: #ccc; }

.member2 { background-color: #1a4a6a; color: #90d1f2; }
.member2:hover { background-color: rgba(88, 166, 255, 0.3); }
.member2 a:link, .member2 a:visited { color: #90d1f2; }

.member3 { background-color: #5a3d1a; color: #d7a96d; }
.member3:hover { background-color: rgba(88, 166, 255, 0.3); }
.member3 a:link, .member3 a:visited { color: #d7a96d; }

.member5 { background-color: #1a3d5a; color: #629fd7; }
.member5:hover { background-color: rgba(88, 166, 255, 0.3); }
.member5 a:link, .member5 a:visited { color: #629fd7; }

.member7 { background-color: #4a2a46; color: #c26cbb; }
.member7 a:link, .member7 a:visited { color: #c26cbb; }

.member9 { background-color: #2a3460; color: #8090d0; }
.member9 a:link, .member9 a:visited { color: #8090d0; }

.member10 { background-color: rgba(180, 40, 30, 0.4); color: #ff8080; }
.member10 a:link, .member10 a:visited { color: #ff8080; }

/* --- Profit/Loss (from ssm.css) --- */
.profit_minus { color: var(--admin-danger); }
.profit_plus { color: var(--admin-success); }

/* --- Count Badges (from ssm.css) --- */
.count1 { font-size: 11px; color: rgba(100, 150, 255, 0.75); }
.count2 { font-size: 11px; color: rgba(220, 100, 220, 0.75); }

/* --- Buttons (from ssm.css) --- */
.button, .button:link, .button:visited {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--admin-accent);
  border: 1px solid var(--admin-accent);
  border-radius: 4px;
  text-decoration: none;
  text-shadow: none;
  cursor: pointer;
}
.button:hover {
  background: var(--admin-accent-hover);
  border-color: var(--admin-accent-hover);
  color: #fff;
}

.order_button, .order_button:link, .order_button:visited {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #2a8a96;
  border: 1px solid #2a8a96;
  border-radius: 4px;
  text-decoration: none;
  text-shadow: none;
}

/* General button width reset (old: button { width: 95% }) */
button { width: auto; }
button.small { padding: 6px 12.5px; }
button.small_grid { margin: 0 10px; padding: 4px 12.5px; }
button.small_v { width: 100%; padding: 6px 0; }

/* --- Page Navigation (from ui.css) --- */
div.page_nav { text-align: center; padding: 10px 0; }

/* --- Result Colors (from ssm.css) --- */
.result_warning { color: var(--admin-warning); }
.result_error { color: var(--admin-danger); }
.result_good { color: var(--admin-text); }

/* --- Status Colors (from ui.css) --- */
i.c_pre { color: #888; }
i.c_na { color: #555; }
i.c_unlink { color: #666; }
i.c_pair { color: #fa6a09; }
i.c_follower { color: #58a6ff; }
i.c_following { color: #3fb950; }

/* --- Money/Payment (from ssm.css) --- */
.money_font { color: var(--admin-accent); font-size: 16px; font-weight: bold; padding: 0 10px; }
.payment_highlight { color: #00bcd4; }
.payment_highlight2 { color: #ff9e6a; }
.payment_inmanager { color: #58a6ff; }
.payment_instagram { color: deeppink; }

/* --- Form (from ui.css) --- */
input.sch_radio, input[type='radio'] { margin: 0; }
.min_check { font-size: 1px; }

/* Misc blocks */
.upload_block { background: var(--admin-surface-2); padding: 5px; border-radius: 4px; }
.reserve_block { background: rgba(88, 166, 255, 0.1); padding: 5px; border-radius: 4px; }
.complete_block { background: var(--admin-surface-2); padding: 5px; border-radius: 4px; }
.auto_width { width: auto; }
.desc { text-align: end; color: var(--admin-text-muted); }
.desc_small { text-align: right; color: var(--admin-text-muted); font-size: 0.8em; }
.desc_left_small { text-align: left; color: var(--admin-text-muted); font-size: 0.8em; }

/* --- Boost/Ticket (from ssm.css) --- */
.boost_avail { color: var(--admin-text); background: var(--admin-surface-2); }
.boost_expire { color: var(--admin-text-muted); background: rgba(210, 153, 34, 0.15); }
.paid_only { background: rgba(88, 166, 255, 0.15) !important; color: var(--admin-text); }
.paid_desc { background: rgba(88, 166, 255, 0.15) !important; color: var(--admin-text); }

/* --- Responsive Grid (from ssm.css) --- */
.rwd-2 .ui-block-a, .rwd-2 .ui-block-b { width: 100%; float: none; }
@media (min-width: 45em) {
  .rwd-2 .ui-block-a, .rwd-2 .ui-block-b { float: left; width: 49.95%; }
}
.rwd-3 .ui-block-a, .rwd-3 .ui-block-b, .rwd-3 .ui-block-c { width: 100%; float: none; }
@media (min-width: 60em) {
  .rwd-3 .ui-block-a, .rwd-3 .ui-block-b, .rwd-3 .ui-block-c { float: left; width: 33.3%; }
}

/* --- Footer --- */
#footer-container { position: absolute; bottom: 0; width: 100%; }
#footer-container-no-top { position: fixed; bottom: 0; width: 100%; z-index: 100; text-align: center; padding: 8px; color: var(--admin-text-muted); font-size: 0.85rem; }

/* --- Toast Notification --- */
#toast-container .toast {
  background: var(--admin-surface-2);
  color: var(--admin-text);
  border: 1px solid var(--admin-border);
  min-width: 280px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* --- Loading Overlay --- */
#loading-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
#loading-overlay.active { display: flex; }
#loading-overlay .spinner-border { width: 3rem; height: 3rem; color: var(--admin-accent); }

/* --- jQuery UI Datepicker Dark Override --- */
.ui-datepicker {
  background: var(--admin-surface) !important;
  border: 1px solid var(--admin-border) !important;
  color: var(--admin-text) !important;
  padding: 4px !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}
.ui-datepicker .ui-datepicker-header {
  background: var(--admin-surface-2) !important;
  border: none !important;
  color: var(--admin-text) !important;
  border-radius: 6px !important;
}
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next {
  cursor: pointer !important;
}
.ui-datepicker .ui-datepicker-prev:hover, .ui-datepicker .ui-datepicker-next:hover {
  background: var(--admin-border) !important;
  border-radius: 4px !important;
}
.ui-datepicker td { padding: 1px !important; }
.ui-datepicker td a, .ui-datepicker td span {
  color: var(--admin-text) !important;
  background: transparent !important;
  border: none !important;
  text-align: center !important;
  padding: 4px !important;
  border-radius: 4px !important;
}
.ui-datepicker td a:hover {
  background: var(--admin-accent) !important;
  color: #fff !important;
}
.ui-datepicker .ui-state-active {
  background: var(--admin-accent) !important;
  color: #fff !important;
}
.ui-datepicker .ui-datepicker-title select {
  background: var(--admin-surface-2) !important;
  color: var(--admin-text) !important;
  border: 1px solid var(--admin-border) !important;
}

/* --- Bootstrap 5 Overrides for Dark Theme Consistency --- */
.form-control, .form-select {
  background-color: var(--admin-surface-2);
  border-color: var(--admin-border);
  color: var(--admin-text);
}
.form-control:focus, .form-select:focus {
  background-color: var(--admin-bg);
  border-color: var(--admin-accent);
  color: var(--admin-text);
  box-shadow: 0 0 0 0.2rem rgba(88, 166, 255, 0.15);
}

/* Login page specific */
#blog-container-no-top h1 {
  color: var(--admin-accent);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--admin-bg); }
::-webkit-scrollbar-thumb { background: var(--admin-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--admin-text-muted); }

/* --- Mobile Responsive --- */
@media (max-width: 991.98px) {
  #admin-sidebar {
    transform: translateX(-100%);
  }
  #admin-sidebar.show {
    transform: translateX(0);
    box-shadow: 4px 0 16px rgba(0,0,0,0.5);
  }
  #blog-container {
    margin-left: 0;
  }
  #header-container {
    left: 0;
  }
}

/* Extra small screens */
@media (max-width: 575.98px) {
  #blog-container {
    padding: 0 0.5rem 0.5rem;
  }
  .admin-card {
    padding: 0.75rem;
    border-radius: 6px;
  }
}
