/* ============================================================
   InstantBook Admin — Design tokens & base styles
   ============================================================ */

:root {
  --primary: #1A73E8;
  --primary-dark: #0D47A1;
  --primary-light: #E8F0FE;
  --secondary: #00C896;
  --accent: #FF6B35;
  --warning: #F59E0B;
  --error: #EF4444;
}

html, body { height: 100%; }

/* Material icon defaults */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  font-size: 20px;
  line-height: 1;
  user-select: none;
}
.icon-sm { font-size: 16px; }
.icon-lg { font-size: 24px; }
.icon-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: #374151; }

/* Focus ring */
.focus-ring:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

/* Inputs */
.ib-input {
  height: 40px;
  width: 100%;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
  color: #0D1117;
  transition: border-color .15s, box-shadow .15s;
}
.ib-input::placeholder { color: #9CA3AF; }
.ib-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.12); }
.dark .ib-input { background: #1F2937; border-color: #374151; color: #F9FAFB; }
textarea.ib-input { height: auto; padding: 10px 12px; resize: vertical; }
select.ib-input { appearance: auto; }

.ib-label { display:block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: #4B5563; }
.dark .ib-label { color: #9CA3AF; }

/* Buttons */
.ib-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: filter .15s, background .15s, opacity .15s;
  border: 1px solid transparent;
}
.ib-btn:disabled { opacity: .5; cursor: not-allowed; }
.ib-btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.ib-btn-primary {
  background: linear-gradient(135deg, #2E86FF 0%, #1A73E8 45%, #0D47A1 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26, 115, 232, .28);
}
.ib-btn-primary:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(26, 115, 232, .38); }
.ib-btn-secondary { background: #fff; color: #0D1117; border-color: #E5E7EB; }
.ib-btn-secondary:hover:not(:disabled) { background: #F9FAFB; }
.dark .ib-btn-secondary { background: #1F2937; color: #F9FAFB; border-color: #374151; }
.dark .ib-btn-secondary:hover:not(:disabled) { background: #374151; }
.ib-btn-danger { background: var(--error); color: #fff; }
.ib-btn-danger-outline { background: transparent; color: var(--error); border-color: #FCA5A5; }
.ib-btn-success { background: #10B981; color: #fff; }
.ib-btn-ghost { background: transparent; color: #4B5563; }
.dark .ib-btn-ghost { color: #9CA3AF; }
.ib-btn-ghost:hover:not(:disabled) { background: #F3F4F6; }
.dark .ib-btn-ghost:hover:not(:disabled) { background: #1F2937; }

/* Cards */
.ib-card {
  background: #fff; border: 1px solid #E5E7EB; border-radius: 12px;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.dark .ib-card { background: #1F2937; border-color: #374151; }
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(13, 71, 161, .10);
  border-color: #D3E3FB;
}
.dark .card-hover:hover { box-shadow: 0 8px 24px rgba(0,0,0,.45); border-color: #3B4A63; }

/* Table */
.ib-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ib-table thead th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .8px; color: #9CA3AF; background: #F9FAFB;
  height: 44px; padding: 0 16px; border-bottom: 1px solid #E5E7EB;
}
.dark .ib-table thead th { background: #111827; border-color: #374151; }
.ib-table tbody td { height: 52px; padding: 8px 16px; border-bottom: 1px solid #F3F4F6; vertical-align: middle; }
.dark .ib-table tbody td { border-color: #374151; }
.ib-table tbody tr:last-child td { border-bottom: none; }
.ib-table tbody tr { transition: background .1s; }
.ib-table tbody tr:hover { background: #F9FAFB; }
.dark .ib-table tbody tr:hover { background: #111827; }
.ib-row-selected { background: #EFF6FF !important; box-shadow: inset 3px 0 0 var(--primary); }
.dark .ib-row-selected { background: #1A2744 !important; }

/* Chips */
.ib-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}

/* Sidebar nav */
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 12px; border-radius: 10px;
  color: #8B949E; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .14s, color .14s;
  text-decoration: none;
}
.nav-item:hover { background: #1F2937; color: #E5E7EB; }
.nav-item.active {
  background: linear-gradient(135deg, #2E86FF, #1A73E8 55%, #0D47A1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(26, 115, 232, .35);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 10px; bottom: 10px;
  width: 3px; border-radius: 3px; background: #4A9EFF;
}
.nav-section {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: #484F58;
  padding: 0 12px; margin: 18px 0 6px;
}

/* --- Drag to reorder the sidebar --- */
.nav-item[draggable='true'] { cursor: grab; }
.nav-item[draggable='true']:active { cursor: grabbing; }
/* The item being dragged fades out */
.nav-item.nav-dragging { opacity: .4; }
/* Blue insertion bar on the item you're hovering over */
.nav-item.nav-drop-before { box-shadow: inset 0 3px 0 0 #4A9EFF; }
.nav-item.nav-drop-after { box-shadow: inset 0 -3px 0 0 #4A9EFF; }
/* Grip appears on hover so the feature is discoverable */
.nav-grip {
  margin-left: auto; opacity: 0; transition: opacity .14s;
  font-size: 16px; line-height: 1; color: #6B7280; flex-shrink: 0;
}
.nav-item:hover .nav-grip { opacity: .75; }
.nav-reset {
  display: block; width: 100%; text-align: left;
  padding: 6px 12px; margin-top: 4px;
  font-size: 11.5px; color: #6B7280; background: none; border: 0;
  cursor: pointer; border-radius: 8px;
}
.nav-reset:hover { color: #E5E7EB; background: #1F2937; }

/* Splash / boot screen */
.splash-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(26,115,232,.10), transparent 65%),
    radial-gradient(45% 40% at 85% 90%, rgba(0,200,150,.06), transparent 60%);
}
.splash-logo-ring { position: relative; width: 140px; height: 140px; display: flex; align-items: center; justify-content: center; }
.splash-logo-ring::before, .splash-logo-ring::after {
  content: ''; position: absolute; inset: 0; border-radius: 38px;
  border: 1.5px solid rgba(26,115,232,.35);
  animation: ring-pulse 2.2s cubic-bezier(.2,.6,.3,1) infinite;
}
.splash-logo-ring::after { animation-delay: 1.1s; }
.splash-logo { animation: logo-in .7s cubic-bezier(.2,.9,.3,1.3) both, logo-float 3.2s ease-in-out 1s infinite; filter: drop-shadow(0 14px 30px rgba(13,71,161,.35)); }
.splash-word { margin-top: 26px; font-size: 24px; font-weight: 800; letter-spacing: .5px; animation: fade-up .6s .25s both; }
.splash-word b { background: linear-gradient(90deg, #4A9EFF, #1A73E8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.splash-tag { margin-top: 6px; font-size: 13px; color: #9CA3AF; letter-spacing: 2.5px; text-transform: uppercase; animation: fade-up .6s .4s both; }
.splash-bar { margin-top: 34px; width: 160px; height: 3px; border-radius: 3px; background: rgba(148,163,184,.25); overflow: hidden; animation: fade-up .6s .55s both; }
.splash-bar i { display: block; height: 100%; width: 40%; border-radius: 3px; background: linear-gradient(90deg, #4A9EFF, #1A73E8); animation: bar-slide 1.1s ease-in-out infinite; }

@keyframes ring-pulse { 0% { transform: scale(.72); opacity: .9; } 100% { transform: scale(1.25); opacity: 0; } }
@keyframes logo-in { from { transform: scale(.55); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes logo-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes fade-up { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes bar-slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 6px;
}
.dark .skeleton {
  background: linear-gradient(90deg, #1F2937 25%, #374151 50%, #1F2937 75%);
  background-size: 200% 100%;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Transitions */
.fade-enter-active, .fade-leave-active { transition: opacity .15s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
.slide-enter-active, .slide-leave-active { transition: transform .22s ease, opacity .22s ease; }
.slide-enter-from, .slide-leave-to { transform: translateX(100%); opacity: .6; }
.pop-enter-active, .pop-leave-active { transition: transform .15s ease, opacity .15s ease; }
.pop-enter-from, .pop-leave-to { transform: scale(.96); opacity: 0; }

/* Toast */
.toast-enter-active, .toast-leave-active { transition: all .25s ease; }
.toast-enter-from { transform: translateY(-8px); opacity: 0; }
.toast-leave-to { opacity: 0; }

/* Phones & tablets — tables become stacked label:value cards */
@media (max-width: 920px) {
  .ib-table { display: block; overflow-x: visible; }
  .ib-table thead { display: none; }
  .ib-table tbody { display: block; }
  .ib-table tbody tr {
    display: block; padding: 14px 16px;
    border-bottom: 1px solid #F3F4F6;
  }
  .dark .ib-table tbody tr { border-color: #374151; }
  .ib-table tbody tr:last-child { border-bottom: none; }
  .ib-table tbody td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; height: auto; min-height: 0; padding: 3px 0;
    border: none; white-space: normal; text-align: left;
  }
  .ib-table tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 600; letter-spacing: .6px;
    text-transform: uppercase; color: #9CA3AF; flex-shrink: 0;
  }
  .ib-table tbody td:empty, .ib-table tbody td.hidden { display: none; }
  .ib-table tbody td.ib-td-actions { justify-content: flex-end; padding-top: 8px; }
}

/* Toasts fit small screens */
@media (max-width: 480px) {
  .toast-region { width: calc(100vw - 24px) !important; right: 12px !important; }
}

/* Misc */
.page-title { font-size: 22px; font-weight: 700; }
.section-title { font-size: 16px; font-weight: 600; }
.text-muted { color: #9CA3AF; }
.dark .text-muted { color: #6B7280; }
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px; background: var(--primary-light); color: var(--primary);
  font-weight: 600; flex-shrink: 0;
}
.dark .avatar-fallback { background: #1A2744; color: #4A9EFF; }

/* Charts must never force horizontal overflow */
.ib-card canvas { max-width: 100% !important; }

/* Grid children may always shrink below content width
   (prevents min-content from stretching the page on phones) */
.grid > * { min-width: 0; }
