/* ============================================================
   TMX ADMIN — Styles
   ============================================================ */

:root {
  --bg: #080808;
  --sidebar: #0D0D0D;
  --card: #111111;
  --elevated: #151515;
  --border: #242424;
  --border-subtle: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-muted: #52525b;
  --orange: #F97316;
  --orange-hover: #EA580C;
  --blue: #2563EB;
  --green: #22C55E;
  --red: #EF4444;
  --yellow: #EAB308;
}

* { font-family: 'Inter', system-ui, sans-serif; box-sizing: border-box; }
body { background: var(--bg); color: var(--text-primary); margin: 0; }
button, input, select, textarea { font-family: inherit; }

/* ============ TYPOGRAPHY ============ */
.t-section { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
.t-card { font-size: 0.9375rem; font-weight: 600; }
.t-body { font-size: 0.875rem; font-weight: 400; }
.t-secondary { font-size: 0.8125rem; font-weight: 400; color: var(--text-secondary); }
.t-micro { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

*:focus-visible { outline: 2px solid rgba(249, 115, 22, 0.45); outline-offset: 2px; border-radius: 0.5rem; }

/* ============ SIDEBAR ============ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 264px;
  background: var(--sidebar); border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 40; overflow: hidden;
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); z-index: 70; }
  .sidebar.open { transform: translateX(0); }
}
.nav-group { padding: 0.5rem 0.75rem; }
.nav-group-label {
  font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  padding: 0.875rem 0.75rem 0.375rem;
}
.nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5625rem 0.75rem; border-radius: 0.5rem;
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  transition: all 0.15s ease; cursor: pointer;
  border: none; background: transparent; width: 100%;
  text-align: left; position: relative;
}
.nav-link:hover { background: var(--elevated); color: var(--text-primary); }
.nav-link.active { background: rgba(249, 115, 22, 0.1); color: var(--orange); font-weight: 600; }
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--orange); border-radius: 0 4px 4px 0;
}
.nav-link i:first-child { width: 16px; text-align: center; font-size: 0.875rem; }
.nav-badge {
  margin-left: auto; background: var(--orange); color: white;
  font-size: 0.625rem; font-weight: 700; padding: 0.125rem 0.4375rem;
  border-radius: 9999px; min-width: 18px; text-align: center;
}

/* ============ CARDS ============ */
.card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.875rem;
  transition: border-color 0.2s ease;
}
.card:hover { border-color: var(--border); }

/* ============ TABLES ============ */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin-table th {
  text-align: left; padding: 0.75rem 1rem; color: var(--text-tertiary);
  font-weight: 600; font-size: 0.75rem; letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--card); position: sticky; top: 0; z-index: 10;
}
.admin-table td {
  padding: 0.9375rem 1rem; border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary); vertical-align: middle;
}
.admin-table tbody tr { transition: background 0.1s ease; }
.admin-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
@media (max-width: 767px) {
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr {
    background: var(--card); border: 1px solid var(--border-subtle);
    border-radius: 0.75rem; padding: 0.75rem; margin-bottom: 0.625rem;
  }
  .admin-table td { padding: 0.375rem 0; border: none; }
  .admin-table td:before {
    content: attr(data-label); display: block;
    font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.25rem;
  }
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; font-size: 0.875rem; font-weight: 600;
  padding: 0.5625rem 1rem; border-radius: 0.5rem;
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.15s ease; white-space: nowrap;
}
.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--elevated); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--text-tertiary); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-tertiary); color: var(--text-primary); }
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-icon {
  width: 32px; height: 32px; border-radius: 0.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); color: var(--text-secondary);
  background: transparent; cursor: pointer; transition: all 0.15s ease;
  position: relative;
}
.btn-icon:hover { border-color: var(--orange); color: var(--orange); }
.btn-icon.danger:hover { border-color: var(--red); color: var(--red); }

.tooltip { position: relative; }
.tooltip:hover::after {
  content: attr(data-tip); position: absolute;
  bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #18181b; color: white; font-size: 0.6875rem;
  padding: 0.25rem 0.5rem; border-radius: 0.375rem;
  white-space: nowrap; border: 1px solid var(--border);
  z-index: 50; pointer-events: none;
}

/* ============ INPUTS ============ */
.input, .select, .textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 0.5rem; padding: 0.5625rem 0.8125rem;
  color: var(--text-primary); font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease; outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 0.375rem;
}
.label .required { color: var(--red); }

/* ============ BADGES ============ */
.badge {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.1875rem 0.5625rem; border-radius: 9999px;
  font-size: 0.6875rem; font-weight: 600;
}
.badge::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; background: currentColor;
}
.badge-pending { background: rgba(234, 179, 8, 0.1); color: #facc15; }
.badge-confirmed { background: rgba(59, 130, 246, 0.1); color: #60a5fa; }
.badge-in_progress { background: rgba(168, 85, 247, 0.1); color: #c084fc; }
.badge-completed { background: rgba(34, 197, 94, 0.1); color: #4ade80; }
.badge-cancelled { background: rgba(239, 68, 68, 0.1); color: #f87171; }

/* ============ MODAL ============ */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(4px);
  z-index: 90; align-items: center; justify-content: center;
  padding: 1rem; animation: fadeIn 0.15s ease;
}
.modal-backdrop.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--sidebar); border: 1px solid var(--border);
  border-radius: 1rem; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============ DRAWER ============ */
.drawer-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); z-index: 90;
}
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 100%; max-width: 460px;
  background: var(--sidebar); border-left: 1px solid var(--border);
  z-index: 91; transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }

/* ============ TOASTS ============ */
.toast-stack {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 100;
  display: flex; flex-direction: column; gap: 0.625rem;
  max-width: calc(100vw - 3rem);
}
.toast {
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: 0.75rem; padding: 0.8125rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.875rem; box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 280px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.info { border-left: 3px solid var(--blue); }
.toast-close {
  color: var(--text-tertiary); cursor: pointer;
  background: none; border: none; padding: 0.25rem;
}

/* ============ NOTIFICATIONS DROPDOWN ============ */
.notif-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px; max-width: calc(100vw - 2rem);
  background: var(--sidebar); border: 1px solid var(--border);
  border-radius: 0.875rem; box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  z-index: 60; overflow: hidden; animation: dropdownIn 0.15s ease;
}
.notif-dropdown.open { display: block; }
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ CHART ============ */
.chart-container { position: relative; height: 280px; }
@media (max-width: 640px) { .chart-container { height: 220px; } }

/* ============ TABS ============ */
.tab-btn {
  padding: 0.4375rem 0.875rem; font-size: 0.8125rem; font-weight: 600;
  border-radius: 0.5rem; color: var(--text-tertiary);
  border: none; background: transparent; cursor: pointer;
  transition: all 0.15s ease;
}
.tab-btn:hover { color: var(--text-primary); background: var(--elevated); }
.tab-btn.active { background: var(--elevated); color: var(--text-primary); }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ============ SECTIONS ============ */
.section { display: none; }
.section.active { display: block; }

/* ============ DROP ZONE ============ */
.drop-zone {
  border: 2px dashed var(--border); border-radius: 0.875rem;
  padding: 2rem 1.5rem; text-align: center; cursor: pointer;
  transition: all 0.2s ease;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--orange); background: rgba(249, 115, 22, 0.05);
}

/* ============ LOADING BAR ============ */
.loading-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: var(--orange); z-index: 200;
  animation: loadingSlide 1.2s ease infinite; transform-origin: left;
}
@keyframes loadingSlide {
  0% { transform: scaleX(0); }
  50% { transform: scaleX(0.7); }
  100% { transform: scaleX(1); opacity: 0; }
}

/* ============ MOBILE OVERLAY ============ */
.mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 65; backdrop-filter: blur(2px);
}
.mobile-overlay.open { display: block; }

/* ============ SKELETON ============ */
.skeleton {
  background: linear-gradient(90deg, #1a1a1a 25%, #222 50%, #1a1a1a 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: 0.5rem;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}