/* =========================
   QIMO THEME (v2 - Modernized)
   - Refined tokens: sleek typography, sophisticated glassmorphism
   - Components: premium buttons, inputs, chips
   - Dark/Light themes
   ========================= */

:root {
  /* ---------- Brand ---------- */
  --blue: #5f83ff;
  --green: #33d69f;
  --amber: #ffb020;
  --red: #ff5a7a;

  /* ---------- Text & Surfaces (Dark default) ---------- */
  --text: #eceff4;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.08);

  --card: rgba(255, 255, 255, 0.03);
  --card2: rgba(0, 0, 0, 0.2);

  /* Button primary */
  --btn: #ffffff;
  --btnText: #0f172a;

  /* ---------- Radius ---------- */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 24px;

  /* ---------- Spacing scale ---------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;

  /* ---------- Shadows ---------- */
  --shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
  --shadow-xs: 0 4px 6px -2px rgba(0, 0, 0, 0.1);

  /* ---------- Focus ring ---------- */
  --focus: rgba(95, 131, 255, 0.25);
  --focusLine: #5f83ff;

  /* ---------- Background gradient ---------- */
  --bg-grad:
    radial-gradient(at 0% 0%, rgba(95, 131, 255, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(51, 214, 159, 0.1) 0px, transparent 50%),
    #0f172a;

  /* ---------- Glass helpers ---------- */
  --glass: rgba(255, 255, 255, 0.02);
  --glass-strong: rgba(30, 41, 59, 0.7);
  --elev: blur(16px);
}

/* ---------- Light theme ---------- */
html[data-theme="light"] {
  --text: #1e293b;
  --muted: #64748b;
  --line: rgba(0, 0, 0, 0.08);

  --card: rgba(255, 255, 255, 0.8);
  --card2: rgba(255, 255, 255, 0.6);

  --btn: #1e293b;
  --btnText: #ffffff;

  --shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 10px 20px -5px rgba(0, 0, 0, 0.06);
  --shadow-xs: 0 4px 6px -2px rgba(0, 0, 0, 0.04);

  --focus: rgba(95, 131, 255, 0.2);

  --bg-grad:
    radial-gradient(at 0% 0%, rgba(95, 131, 255, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(51, 214, 159, 0.08) 0px, transparent 50%),
    #f8fafc;

  --glass: rgba(255, 255, 255, 0.7);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --elev: blur(12px);
}

/* ---------- Base reset ---------- */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;

  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 400;
  /* Regular weight by default */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Scrollbar ---------- */
*::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 99px;
}

html[data-theme="light"] *::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5);
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}


/* =========================================
   Buttons
   ========================================= */

.btn {
  border: 0;
  background: var(--btn);
  color: var(--btnText);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  filter: contrast(1.1);
}

.btn:active {
  transform: translateY(0);
  opacity: 0.95;
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn.sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
}

.btn.lg {
  padding: 14px 24px;
  font-size: 16px;
}

.btn.primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(95, 131, 255, 0.3);
}

.btn.primary:hover {
  background: #4b73ff;
  box-shadow: 0 6px 16px rgba(95, 131, 255, 0.4);
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

html[data-theme="light"] .ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.15);
}

.ghost:active {
  transform: scale(0.98);
}

.ghost.danger {
  color: var(--red);
  border-color: rgba(255, 90, 122, 0.3);
}

.ghost.danger:hover {
  background: rgba(255, 90, 122, 0.1);
  border-color: var(--red);
}

.iconBtn,
.themeBtn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.iconBtn:hover,
.themeBtn:hover {
  background: rgba(255, 255, 255, 0.08);
  /* Dark mode hover */
  color: var(--text);
}

html[data-theme="light"] .iconBtn:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* SVG Icon Helper */
.icon,
.i {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* =========================================
   Inputs
   ========================================= */

.input {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}

html[data-theme="light"] .input {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.15);
}

.input:focus {
  border-color: var(--focusLine);
  box-shadow: 0 0 0 3px var(--focus);
}

.input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

/* Select Custom Arrow */
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.textarea {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

/* File Input */
input[type="file"] {
  padding: 8px;
  background: var(--card);
  border: 1px dashed var(--line);
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 0;
  background: var(--blue);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}


/* =========================================
   Badges / Chips
   ========================================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  /* Subtle dark mode bg */
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

html[data-theme="light"] .badge {
  background: rgba(0, 0, 0, 0.06);
  color: #334155;
}

/* Status Logic */
.statusBadge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.statusDot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* New */
.status-new,
.chip.new {
  background: rgba(95, 131, 255, 0.15);
  color: #8ba6ff;
}

.status-new .statusDot,
.chip.new .dot {
  background: var(--blue);
}

html[data-theme="light"] .status-new {
  background: rgba(95, 131, 255, 0.1);
  color: var(--blue);
}

/* Preparing */
.status-preparing,
.chip.preparing {
  background: rgba(255, 176, 32, 0.15);
  color: #ffca63;
}

.status-preparing .statusDot,
.chip.preparing .dot {
  background: var(--amber);
}

html[data-theme="light"] .status-preparing {
  background: rgba(255, 176, 32, 0.1);
  color: #d97706;
}

/* Ready */
.status-ready,
.chip.ready {
  background: rgba(51, 214, 159, 0.15);
  color: #6ee6bd;
}

.status-ready .statusDot,
.chip.ready .dot {
  background: var(--green);
}

html[data-theme="light"] .status-ready {
  background: rgba(51, 214, 159, 0.1);
  color: #059669;
}

/* Closed */
.status-closed,
.chip.closed {
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted);
}

.status-closed .statusDot,
.chip.closed .dot {
  background: var(--muted);
}


/* =========================================
   Skeleton / Empty / Toast
   ========================================= */
.skeleton {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.emptyIcon {
  margin: 0 auto 16px;
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-success i {
  color: var(--green);
}

.toast-error i {
  color: var(--red);
}

/* Default visibility (Dark mode is default) */
.logo-light {
  display: block;
}

.logo-dark {
  display: none;
}

/* =========================================
   Dynamic Logo (Theme-based)
   ========================================= */

/* Dark theme: show white logo (logo2), hide black logo (logo1) */
html[data-theme="dark"] .logo-light {
  display: block;
}

html[data-theme="dark"] .logo-dark {
  display: none;
}

/* Light theme: show black logo (logo1), hide white logo (logo2) */
html[data-theme="light"] .logo-light {
  display: none;
}

html[data-theme="light"] .logo-dark {
  display: block;
}

/* =========================================
   Dashboard Widgets
   ========================================= */

/* Quick Action Buttons */
.qaBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--bg2);
  border: 1px solid transparent;
  /* Cleaner look */
  border-radius: var(--radius);
  /* More rounded */
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  /* Subtle initial shadow */
}

.qaBtn:hover {
  background: var(--card);
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  /* Modern hover shadow */
  border-color: transparent;
}

.qaIcon {
  font-size: 32px;
  line-height: 1;
}

.qaText {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.hidden {
  display: none !important;
}

/* User Dropdown Menu */
.userDropdownMenu {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  z-index: 9999;
}

html[data-theme="light"] .userDropdownMenu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.userDropdownMenu .btn.ghost {
  border: none;
  background: transparent;
}

.userDropdownMenu .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] .userDropdownMenu .btn.ghost:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Summary Cards */
.summaryItem {
  transition: transform 0.2s;
}

.summaryItem:hover {
  transform: translateX(4px);
  background: var(--card) !important;
}

/* Table Summary Bar */
.ts-bar {
  position: relative;
  background: rgba(0, 0, 0, 0.1);
}

.ts-fill {
  position: relative;
  border-radius: 99px;
  box-shadow: 0 0 10px rgba(95, 131, 255, 0.3);
}

/* Activity List */
.activityItem {
  transition: background 0.2s;
}

.activityItem:hover {
  background: var(--card) !important;
}


/* =========================================
   Draggable Dashboard
   ========================================= */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
  align-items: start;
}

@media (max-width: 768px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
}

.dash-widget {
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  height: 100%;
}

/* Edit Mode Styles */
body.dash-edit-mode .dash-widget {
  border: 2px dashed var(--focusLine);
  cursor: grab;
  position: relative;
  background: var(--bg1);
  /* Make draggable widgets stand out */
}

body.dash-edit-mode .dash-widget::after {
  content: "⣿";
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 20px;
  color: var(--focusLine);
  opacity: 0.5;
  pointer-events: none;
}

body.dash-edit-mode .dash-widget:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

body.dash-edit-mode .dash-widget:active {
  cursor: grabbing;
}

/* Dragging States */
.dash-widget.dragging {
  opacity: 0.4;
  border-color: var(--primary);
  transform: scale(0.98);
}

.dash-widget.drag-over {
  border: 2px solid var(--primary);
  background: rgba(95, 131, 255, 0.05);
}

/* Toggle Menu Styles */
/* Toggle Menu Styles */
#widgetToggleMenu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #1f2229;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 8px;
  z-index: 100;
  min-width: 220px;

  /* Animation State: Hidden */
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
  pointer-events: none;
  visibility: hidden;
  /* Ensure it doesn't block anything */
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.2s;

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#widgetToggleMenu.active {
  /* Animation State: Visible */
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.2s;
}

.toggle-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.toggle-item input {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  border-radius: 4px;
}

/* =========================================
   Toast Notification System (New)
   ========================================= */
#qimo-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  pointer-events: none;
  /* Let clicks pass through container */
}

.qimo-toast {
  background: #1a1d24;
  /* Dark bg */
  color: #fff;
  min-width: 300px;
  max-width: 400px;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  /* Catch clicks on toast */
  animation: toastSlideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-left: 4px solid var(--primary);
  font-size: 14px;
  line-height: 1.5;
}

.qimo-toast.success {
  border-left-color: var(--green);
}

.qimo-toast.error {
  border-left-color: var(--red);
}

.qimo-toast-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.qimo-toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* Coming Soon Sidebar Items */
.navItem.coming-soon {
  opacity: 0.5;
  cursor: not-allowed;
  position: relative;
}

.navItem.coming-soon:hover {
  background: transparent;
  color: var(--muted);
}

/* Top Search Enhancement */
.topSearch input {
  transition: all 0.3s ease;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  width: 100%;
}

.topSearch input:focus {
  background: var(--bg1);
  box-shadow: 0 0 0 3px rgba(95, 131, 255, 0.15);
  border-color: var(--primary);
}

/* Make sure the input width transition works */
@media (min-width: 768px) {
  .topSearch input {
    width: 100%;
  }
}