/* Orbit Mail static template — theme variables & custom styles.
   Utilities/layout come from the Tailwind Play CDN (see index.html config). */

:root {
  --icon-color: #6d6d6d;
  --page-bg: #ffffff;
  --panel-bg: #ffffff;
  --panel-border: #e7e7e7;
  --hover-row: #f5f5f5;
  --input-bg: #ffffff;
  --muted-text: #6d6d6d;
  --subtle-text: #8c8c8c;
  --chip-bg: #313131;
  --pop-bg: #ffffff;
}

.dark {
  --icon-color: #898989;
  --page-bg: #141414;
  --panel-bg: #1a1a1a;
  --panel-border: #252525;
  --hover-row: #222222;
  --input-bg: #141414;
  --muted-text: #8c8c8c;
  --subtle-text: #8c8c8c;
  --chip-bg: #313131;
  --pop-bg: #1a1a1a;
}

html,
body {
  height: 100%;
}

body {
  background: var(--page-bg);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Hide scrollbar but keep functionality */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Thin styled scrollbar for panels that keep it */
.thin-scroll::-webkit-scrollbar {
  width: 6px;
}
.thin-scroll::-webkit-scrollbar-thumb {
  background: rgba(140, 140, 140, 0.4);
  border-radius: 999px;
}
.thin-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* Resizer handle */
.resizer-handle {
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}
.resizer-handle:hover .resizer-bar,
.resizer-handle.dragging .resizer-bar {
  background: #006ffe;
  opacity: 1;
}

/* Search highlight */
.hl {
  background: rgba(0, 111, 254, 0.18);
  border-radius: 3px;
  padding: 0 1px;
}
.dark .hl {
  background: rgba(0, 111, 254, 0.45);
}

/* kbd hint */
.kbd {
  display: inline-flex;
  align-items: center;
  max-height: 100%;
  height: 1.5rem;
  margin-left: auto;
  margin-right: -0.25rem;
  border: 1px solid rgba(109, 109, 109, 0.15);
  background: rgba(109, 109, 109, 0.08);
  border-radius: 6px;
  padding: 0 6px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.5rem;
}

/* Email body inside thread view */
.mail-body {
  font-size: 14px;
  line-height: 1.65;
  color: inherit;
  overflow-wrap: anywhere;
}
.mail-body p {
  margin-bottom: 0.6rem;
}
.mail-body a {
  color: #006ffe;
  text-decoration: underline;
}
.mail-body img {
  max-width: 100%;
  border-radius: 8px;
}

/* Compose editor */
.compose-editor {
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
}
.compose-editor:empty::before {
  content: attr(data-placeholder);
  color: #8c8c8c;
  pointer-events: none;
}

/* Compose gradient button (from original globals.css) */
.compose-gradient-animated {
  background: linear-gradient(
    90deg,
    rgba(255, 213, 208, 1),
    rgba(219, 255, 228, 1),
    rgba(226, 214, 255, 1),
    rgba(255, 213, 208, 1)
  );
  background-size: 300% 100%;
  animation: gradient-animation 8s ease infinite;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}
@keyframes gradient-animation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* AI typing shimmer + caret */
@keyframes shine-slow {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
.animate-shine-slow {
  animation: shine-slow 8s linear infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.animate-blink {
  animation: blink 0.8s ease-in-out infinite;
}
.shimmer-text {
  background: linear-gradient(to right, #737373 20%, #d4d4d4 40%, #d4d4d4 60%, #737373 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Toast entrance */
@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.toast-in {
  animation: toast-in 0.22s ease-out;
}

/* Category tab overlay wipe (mirrors original clip-path transition) */
.cat-wipe {
  transition: clip-path 0.3s ease-in-out;
}

/* Tooltips (native-ish custom, shown on hover via CSS) */
.tip {
  position: relative;
}
.tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  background: var(--chip-bg);
  color: #e8e8e8;
  font-size: 11px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 60;
}
.tip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Never show an empty/useless pill */
.tip:not([data-tip])::after,
.tip[data-tip=""]::after {
  display: none;
}

/* Simple dropdown */
.dropdown-panel {
  transform-origin: top right;
  animation: toast-in 0.15s ease-out;
}

/* Line clamp fallback (Tailwind CDN includes line-clamp core now, kept for safety) */
.clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- shared settings/form primitives (mirror shadcn styles) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: #18181b;
  color: #fafafa;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.dark .btn {
  background: #fafafa;
  color: #18181b;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  border-color: #e4e4e7;
  color: inherit;
}
.dark .btn-outline { border-color: #3f3f46; }
.btn-destructive {
  background: #dc2626;
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  padding: 0 0.5rem;
}
.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #e4e4e7;
  background: transparent;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  padding: 0 0.75rem;
  outline: none;
}
.dark .input, .dark .select, .dark .textarea { border-color: #3f3f46; }
.input, .select { height: 2.25rem; }
.textarea { padding: 0.5rem 0.75rem; min-height: 150px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #006ffe; }
.input::placeholder, .textarea::placeholder { color: #a1a1aa; }
select.select option { color: #18181b; background: #fff; }
.dark select.select option { color: #fafafa; background: #1a1a1a; }
.flabel {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}
.fdesc {
  font-size: 0.8rem;
  color: var(--muted-text);
  margin-top: 0.375rem;
}
.set-card {
  background: var(--panel-bg);
  border: none;
  width: 100%;
  padding: 0;
}
.set-card-title { font-size: 1.125rem; font-weight: 600; }
.set-card-desc { font-size: 0.875rem; color: var(--muted-text); margin-top: 0.25rem; }

/* switch */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}
.switch input { display: none; }
.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #e4e4e7;
  transition: background 0.2s;
}
.dark .switch .track { background: #3f3f46; }
.switch input:checked + .track { background: #18181b; }
.dark .switch input:checked + .track { background: #fafafa; }
.switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.dark .switch .thumb { background: #18181b; }
.dark .switch input:checked + .thumb { background: #18181b; }
.switch input:checked ~ .thumb { transform: translateX(16px); }
.dark .switch input:not(:checked) + .track { background: rgba(255,255,255,0.15); }
.dark .switch .thumb { background: #fafafa; }
.dark .switch input:checked + .track { background: #fafafa; }
.dark .switch input:checked ~ .thumb { background: #18181b; }

/* kbd chip in shortcut table */
.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid #e4e4e7;
  background: #f4f4f5;
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
}
.dark .key { border-color: #3f3f46; background: #27272a; }
