/* ═══════════════════════════════════════════════
   PPTX AI — Glassmorphism Design System
   Light/Dark themes, blur panels, gradient depth
   ═══════════════════════════════════════════════ */

/* ─── Light Theme (default) ──────────────────── */

:root,
[data-theme="light"] {
  --canvas: #f0f2f7;
  --bg-glass: rgba(255, 255, 255, 0.45);
  --bg-glass-strong: rgba(255, 255, 255, 0.65);
  --bg-glass-subtle: rgba(255, 255, 255, 0.25);
  --glass-blur: 24px;
  --glass-saturate: saturate(180%);
  --bg-solid: #ffffff;
  --bg-input: rgba(0, 0, 0, 0.04);
  --bg-input-hover: rgba(0, 0, 0, 0.06);

  --dot-color: rgba(0, 0, 0, 0.07);
  --dot-size: 1px;
  --dot-gap: 24px;

  --text-0: #1a1d2e;
  --text-1: #4a4e69;
  --text-2: #8b8fa3;
  --text-3: #b0b4c4;

  --accent: #1a1a1a;
  --accent-hover: #000000;
  --accent-subtle: rgba(0, 0, 0, 0.06);
  --accent-glow: rgba(0, 0, 0, 0.12);
  --secondary: #555555;
  --secondary-subtle: rgba(0, 0, 0, 0.05);

  --border-glass: rgba(255, 255, 255, 0.5);
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.14);

  --success: #3daa5c;
  --success-bg: rgba(61, 170, 92, 0.1);
  --error: #dc4545;
  --error-bg: rgba(220, 69, 69, 0.08);
  --warning: #d09620;
  --warning-bg: rgba(208, 150, 32, 0.08);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.06);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --specular: rgba(255, 255, 255, 0.5);

  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Dark Theme ─────────────────────────────── */

[data-theme="dark"] {
  --canvas: #111113;
  --bg-glass: rgba(24, 24, 27, 0.6);
  --bg-glass-strong: rgba(30, 30, 34, 0.75);
  --bg-glass-subtle: rgba(24, 24, 27, 0.4);
  --glass-blur: 28px;
  --glass-saturate: saturate(140%);
  --bg-solid: #18181b;
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-hover: rgba(255, 255, 255, 0.09);

  --dot-color: rgba(255, 255, 255, 0.04);
  --dot-size: 1px;
  --dot-gap: 24px;

  --text-0: #ececef;
  --text-1: #a1a1a8;
  --text-2: #62626a;
  --text-3: #3f3f44;

  --accent: #ffffff;
  --accent-hover: #e0e0e0;
  --accent-subtle: rgba(255, 255, 255, 0.08);
  --accent-glow: rgba(255, 255, 255, 0.14);
  --secondary: #a0a0a0;
  --secondary-subtle: rgba(255, 255, 255, 0.06);

  --border-glass: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  --success: #6dba7a;
  --success-bg: rgba(109, 186, 122, 0.12);
  --error: #e06060;
  --error-bg: rgba(224, 96, 96, 0.1);
  --warning: #e0a83a;
  --warning-bg: rgba(224, 168, 58, 0.1);

  --specular: rgba(255, 255, 255, 0.04);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.45);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ─── Reset ──────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--text-1);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Dot Grid Background ────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--dot-color) var(--dot-size), transparent var(--dot-size));
  background-size: var(--dot-gap) var(--dot-gap);
  z-index: -1;
}

/* ─── Glass Mixin Pattern ────────────────────── */
/* Usage: apply these properties to glass panels:
   background: var(--bg-glass);
   backdrop-filter: blur(var(--glass-blur));
   -webkit-backdrop-filter: blur(var(--glass-blur));
   border: 1px solid var(--border-glass);
*/

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(1px)) {
  :root, [data-theme="light"] {
    --bg-glass: rgba(255, 255, 255, 0.92);
    --bg-glass-strong: rgba(255, 255, 255, 0.96);
    --glass-saturate: ;
  }
  [data-theme="dark"] {
    --bg-glass: rgba(25, 27, 45, 0.95);
    --bg-glass-strong: rgba(30, 32, 55, 0.97);
    --glass-saturate: ;
  }
}

/* ─── App Layout ─────────────────────────────── */

.app {
  display: flex;
  height: 100vh;
  padding: 10px;
  gap: 10px;
}

/* ─── Preview Panel ──────────────────────────── */

.panel-preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 28px;
}

.preview-empty {
  text-align: center;
  position: relative;
  z-index: 1;
}

.preview-empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  opacity: 0.25;
  animation: float 4s ease-in-out infinite;
}

.preview-empty-icon svg {
  width: 100%;
  height: 100%;
}

.preview-empty-icon svg rect:first-child {
  fill: var(--text-2);
  opacity: 0.35;
}

.preview-empty-icon svg rect:last-child {
  fill: var(--text-1);
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.preview-empty-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-0);
  letter-spacing: -1px;
  margin-bottom: 8px;
  opacity: 0.2;
}

.preview-empty-text {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
}

.preview-wrapper {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.preview-frame {
  border: none;
  background: var(--canvas);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
}

/* ─── Slide Navigation ───────────────────────── */

.slide-nav {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 8px 14px;
  backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
  -webkit-backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
  box-shadow: var(--shadow-glass), inset 0 1px 0 0 var(--specular);
  z-index: 2;
}

.slide-dots {
  display: flex;
  gap: 4px;
  max-width: 280px;
  overflow-x: auto;
  scrollbar-width: none;
}
.slide-dots::-webkit-scrollbar { display: none; }

.slide-dot {
  width: 22px;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input);
  border: none;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
  padding: 0;
}
.slide-dot:hover { background: var(--border-hover); }
.slide-dot.active {
  background: var(--accent);
  width: 30px;
  box-shadow: 0 0 10px var(--accent-glow);
}

.slide-nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slide-nav-controls button,
.btn-fullscreen {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-1);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}

.slide-nav-controls button:hover,
.btn-fullscreen:hover {
  background: var(--border-hover);
  color: var(--text-0);
}

.slide-info {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  min-width: 50px;
  text-align: center;
  letter-spacing: 0.5px;
}

/* ─── Chat Panel ─────────────────────────────── */

.panel-chat {
  width: 400px;
  min-width: 400px;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
  -webkit-backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass), inset 0 1px 0 0 var(--specular);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-chat-header {
  padding: 18px 20px 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.logo-mark svg {
  width: 100%;
  height: 100%;
}

.logo-mark svg rect:first-child {
  fill: var(--text-2);
  opacity: 0.35;
}

.logo-mark svg rect:last-child {
  fill: var(--text-1);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-0);
}

/* ─── Theme Toggle ───────────────────────────── */

.theme-toggle {
  width: 36px;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--border-hover);
  color: var(--text-0);
  border-color: var(--border-hover);
}

/* ─── Input Screen ───────────────────────────── */

.input-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 0 20px 20px;
}

.input-screen > * {
  animation: reveal 0.5s var(--ease-spring) backwards;
}
.input-screen > :nth-child(1) { animation-delay: 0.04s; }
.input-screen > :nth-child(2) { animation-delay: 0.08s; }
.input-screen > :nth-child(3) { animation-delay: 0.12s; }
.input-screen > :nth-child(4) { animation-delay: 0.16s; }
.input-screen > :nth-child(5) { animation-delay: 0.2s; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  margin-top: 16px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ─── Textarea (source + chat) ───────────────── */

textarea,
.chat-textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text-0);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.65;
  resize: none;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
  min-height: 160px;
}
textarea:focus,
.chat-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  background: var(--bg-input-hover);
}
textarea::placeholder,
.chat-textarea::placeholder { color: var(--text-2); }

/* Chat textarea is smaller */
.chat-textarea {
  min-height: 42px;
  max-height: 120px;
  flex: unset;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

/* ─── Primary Button ─────────────────────────── */

.btn-primary {
  margin-top: 10px;
  padding: 13px 20px;
  background: var(--accent);
  color: var(--canvas);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 24px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── Generation Progress ────────────────────── */

.gen-progress {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  animation: reveal 0.3s var(--ease-spring);
}

.gen-progress-bar {
  height: 3px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
}

.gen-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 12px var(--accent-glow);
  animation: progress-glow 2s ease-in-out infinite;
}

@keyframes progress-glow {
  0%, 100% { box-shadow: 0 0 8px var(--accent-glow); }
  50% { box-shadow: 0 0 24px var(--accent-glow); }
}

.gen-progress-text {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gen-progress-text::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.btn-cancel {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  align-self: flex-start;
}
.btn-cancel:hover {
  border-color: var(--error);
  color: var(--error);
}

/* Access restriction banner */
.access-banner {
  margin-top: 16px;
  padding: 14px 20px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* ─── Chat Screen ────────────────────────────── */

#chat-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 20px 20px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── Chat Messages ──────────────────────────── */

.chat-msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.55;
  max-width: 92%;
  word-wrap: break-word;
  animation: msg-in 0.3s var(--ease-spring);
  position: relative;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.user {
  background: var(--accent);
  color: var(--canvas);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.chat-msg.ai {
  background: var(--bg-glass-strong);
  color: var(--text-1);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chat-msg.system {
  background: transparent;
  color: var(--text-2);
  font-size: 11px;
  text-align: center;
  align-self: center;
  padding: 4px 0;
}

/* ─── Queue Status Badges ────────────────────── */

.queue-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 500;
}

.queue-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.queue-status.pending {
  color: var(--text-2);
}
.queue-status.pending .queue-status-dot {
  background: var(--text-3);
}

.queue-status.processing {
  color: var(--accent);
}
.queue-status.processing .queue-status-dot {
  background: var(--accent);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.queue-status.done {
  color: var(--success);
}
.queue-status.done .queue-status-dot {
  background: var(--success);
}

.queue-status.error {
  color: var(--error);
}
.queue-status.error .queue-status-dot {
  background: var(--error);
}

.queue-status.cancelled {
  color: var(--text-3);
  text-decoration: line-through;
}

/* Queue action buttons */
.queue-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.queue-action-btn {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.queue-action-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-1);
  background: var(--bg-input);
}
.queue-action-btn.cancel:hover {
  border-color: var(--error);
  color: var(--error);
}

/* ─── Typing Indicator ───────────────────────── */

.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  align-self: flex-start;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
  animation: msg-in 0.3s var(--ease-spring);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-2);
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.32s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* ─── Quick Actions ──────────────────────────── */

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.action-chip {
  padding: 5px 11px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.action-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

/* ─── Chat Input ─────────────────────────────── */

.chat-input-row {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-end;
}

.btn-send {
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: var(--canvas);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}
.btn-send:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* ─── Chat Actions ───────────────────────────── */

.chat-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-shrink: 0;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-input);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.btn-action:hover {
  background: var(--border-hover);
  border-color: var(--border-hover);
}
.btn-action-icon { font-size: 14px; }

.btn-action-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-action-ghost:hover {
  color: var(--text-1);
  background: var(--bg-input);
  border-color: var(--border);
}

/* ─── Toast Notifications ────────────────────── */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid;
  pointer-events: auto;
  animation: toast-in 0.4s var(--ease-spring);
  max-width: 360px;
  line-height: 1.4;
  box-shadow: var(--shadow-md);
}

.toast.info {
  background: var(--bg-glass-strong);
  border-color: var(--border-glass);
  color: var(--text-1);
}

.toast.success {
  background: var(--success-bg);
  border-color: rgba(61, 170, 92, 0.2);
  color: var(--success);
}

.toast.error {
  background: var(--error-bg);
  border-color: rgba(220, 69, 69, 0.2);
  color: var(--error);
}

.toast.warning {
  background: var(--warning-bg);
  border-color: rgba(208, 150, 32, 0.2);
  color: var(--warning);
}

@keyframes toast-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateX(40px); opacity: 0; }
}

/* ─── Fullscreen Overlay ─────────────────────── */

.fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9000;
  overflow: hidden;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fullscreen-frame {
  position: absolute;
  border: none;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  background: #000;
}

.fullscreen-close {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s var(--ease);
}
.fullscreen-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.fullscreen-nav {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 10px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.fullscreen-nav button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}
.fullscreen-nav button:hover {
  background: rgba(255, 255, 255, 0.18);
  color: white;
}

#fullscreen-slide-info {
  font-family: var(--font-display);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 600;
  min-width: 50px;
  text-align: center;
}

/* ─── Auth Overlay ───────────────────────────── */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: var(--canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.3s ease;
}

.auth-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--dot-color) var(--dot-size), transparent var(--dot-size));
  background-size: var(--dot-gap) var(--dot-gap);
  pointer-events: none;
}

.auth-card {
  position: relative;
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  width: 400px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
  -webkit-backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-logo .logo-mark {
  width: 32px;
  height: 32px;
}

.auth-logo .logo-text {
  font-size: 20px;
}

.auth-email-badge {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: center;
}

.auth-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 4px;
}

.auth-links a {
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s var(--ease);
  text-decoration: none;
}

.auth-links a:hover {
  color: var(--text-0);
}

.auth-confirm-icon {
  font-size: 36px;
  text-align: center;
  margin-bottom: 4px;
}

.auth-confirm-text {
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.auth-confirm-text strong {
  color: var(--text-0);
}

.auth-error {
  background: var(--error-bg);
  border: 1px solid rgba(220, 69, 69, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--error);
  font-size: 13px;
  margin-bottom: 16px;
  animation: reveal 0.2s ease;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.auth-form input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-0);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.auth-form input::placeholder { color: var(--text-2); }

.auth-form .btn-primary {
  margin-top: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--text-2);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  margin-bottom: 12px;
}

.btn-google:hover {
  background: var(--bg-input-hover);
  border-color: var(--border-hover);
  color: var(--text-0);
}

.auth-forgot {
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s var(--ease);
  text-decoration: none;
}

.auth-forgot:hover { color: var(--text-0); }

.auth-forgot:hover { color: var(--accent); }

/* ─── Sidebar ────────────────────────────────── */

.sidebar {
  width: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
  -webkit-backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass), inset 0 1px 0 0 var(--specular);
  display: flex;
  flex-direction: column;
  transition: width 0.2s var(--ease-spring), min-width 0.2s var(--ease-spring), opacity 0.15s var(--ease);
  flex-shrink: 0;
  opacity: 0;
}

.sidebar.open {
  width: 280px;
  min-width: 280px;
  opacity: 1;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.3px;
}

.sidebar-header-actions {
  display: flex;
  gap: 4px;
}

.sidebar-action-btn {
  height: 30px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.sidebar-action-btn:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar-action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.sidebar-empty {
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  padding: 32px 16px;
  white-space: nowrap;
}

/* ─── Folder Items ───────────────────────────── */

.folder-item {
  margin-bottom: 2px;
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  position: relative;
  user-select: none;
}

.folder-header:hover {
  background: var(--bg-input);
}

.folder-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-2);
  transition: transform 0.2s var(--ease);
  flex-shrink: 0;
}

.folder-chevron.expanded {
  transform: rotate(90deg);
}

.folder-icon {
  width: 16px;
  height: 16px;
  color: var(--secondary);
  flex-shrink: 0;
}

.folder-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-0);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.folder-name-input {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-0);
  background: var(--bg-input);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  outline: none;
  font-family: var(--font-body);
  flex: 1;
  min-width: 0;
}

/* ─── Inline Folder Create ─────────────────────── */

.folder-inline-create {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--accent);
  animation: inline-create-in 0.15s var(--ease);
}

.folder-inline-create.saving {
  opacity: 0.5;
  pointer-events: none;
}

@keyframes inline-create-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.folder-inline-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-0);
  background: transparent;
  border: none;
  outline: none;
  padding: 2px 0;
}

.folder-inline-input::placeholder {
  color: var(--text-3);
}

.folder-inline-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s var(--ease);
}

.folder-inline-btn.confirm {
  background: var(--accent);
  color: var(--canvas);
}

.folder-inline-btn.confirm:hover {
  background: var(--accent-hover);
}

.folder-inline-btn.cancel {
  background: transparent;
  color: var(--text-2);
}

.folder-inline-btn.cancel:hover {
  background: var(--bg-input-hover);
  color: var(--text-1);
}

/* ─── Inline Folder Delete Confirm ──────────────── */

.folder-delete-confirm {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  animation: inline-create-in 0.12s var(--ease);
}

.folder-delete-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--error);
  white-space: nowrap;
}

.folder-inline-btn.confirm-delete {
  background: var(--error);
  color: white;
}

.folder-inline-btn.confirm-delete:hover {
  filter: brightness(0.9);
}

/* ─── Folder Actions ────────────────────────────── */

.folder-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

.folder-header:hover .folder-actions {
  opacity: 1;
}

.folder-action-btn {
  width: 22px;
  height: 22px;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
  padding: 0;
}

.folder-action-btn:hover {
  background: var(--bg-input);
  color: var(--text-1);
}

.folder-action-btn.delete:hover {
  background: var(--error-bg);
  color: var(--error);
}

.folder-children {
  padding-left: 16px;
  overflow: hidden;
  transition: max-height 0.2s var(--ease-spring);
}

.folder-children.collapsed {
  max-height: 0 !important;
}

/* ─── Sidebar Presentation Items ─────────────── */

.sidebar-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  position: relative;
  margin-bottom: 2px;
}

.sidebar-item:hover {
  background: var(--bg-input);
}

.sidebar-item.active {
  background: var(--accent-subtle);
  border: 1px solid var(--accent-glow);
}

.sidebar-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 24px;
  line-height: 1.4;
}

.sidebar-item-date {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 3px;
  white-space: nowrap;
}

.sidebar-item-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s var(--ease);
  padding: 0;
}

.sidebar-item:hover .sidebar-item-delete { opacity: 1; }

.sidebar-item-delete:hover {
  background: var(--error-bg);
  color: var(--error);
}

/* ─── Sidebar Move Menu ──────────────────────── */

.move-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
  -webkit-backdrop-filter: blur(var(--glass-blur)) var(--glass-saturate);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 4px;
  min-width: 180px;
  z-index: 100;
  box-shadow: var(--shadow-md);
  animation: reveal 0.2s var(--ease-spring);
}

.move-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-1);
  transition: all 0.15s var(--ease);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}

.move-menu-item:hover {
  background: var(--bg-input);
  color: var(--text-0);
}

.move-menu-item svg {
  width: 14px;
  height: 14px;
  color: var(--secondary);
  flex-shrink: 0;
}

/* ─── Sidebar Footer ─────────────────────────── */

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  white-space: nowrap;
  margin-top: auto;
}

.sidebar-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-align: left;
}

.sidebar-profile-btn:hover {
  background: var(--bg-input);
  border-color: var(--border);
}

.sidebar-avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-email {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ─── Profile Overlay ────────────────────────── */

.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 9600;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 0.2s ease;
}

[data-theme="dark"] .profile-overlay {
  background: rgba(0, 0, 0, 0.55);
}

.profile-card {
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 28px 20px;
  width: 380px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: reveal 0.3s var(--ease-spring);
}

.profile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.profile-card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.3px;
}

.profile-card-close {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 22px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s var(--ease);
}

.profile-card-close:hover {
  background: var(--bg-input);
  color: var(--text-0);
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding: 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  flex-shrink: 0;
}

.profile-email {
  font-size: 14px;
  color: var(--text-0);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.profile-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.2px;
}

.profile-section input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-0);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.profile-section input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.profile-section input::placeholder { color: var(--text-2); }

.profile-save-btn {
  margin-top: 2px;
}

.profile-accounts {
  margin-bottom: 16px;
}

.profile-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.profile-account-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover, var(--border));
}

.profile-account-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-2);
}

.profile-account-email {
  color: var(--text-1);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.profile-account-btn.remove {
  background: none;
  color: var(--text-2);
  border: none;
  padding: 4px 6px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s var(--ease);
}

.profile-account-btn.remove:hover {
  color: var(--error);
}

.profile-add-account-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  margin-bottom: 16px;
}

.profile-add-account-btn:hover {
  border-color: var(--text-2);
  color: var(--text-1);
}

.profile-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 16px;
}

.profile-logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.profile-logout-btn:hover {
  background: var(--error-bg);
  border-color: rgba(220, 69, 69, 0.2);
  color: var(--error);
}

/* ─── Sidebar Toggle ─────────────────────────── */

.sidebar-toggle {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px) var(--glass-saturate);
  -webkit-backdrop-filter: blur(12px) var(--glass-saturate);
  box-shadow: var(--shadow-sm), inset 0 1px 0 0 var(--specular);
  transition: all 0.2s var(--ease);
}

.sidebar-toggle:hover {
  background: var(--bg-glass-strong);
  color: var(--text-0);
  border-color: var(--border-hover);
}

.sidebar-toggle.visible {
  display: flex;
}

/* ─── Scrollbar ──────────────────────────────── */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ─── Responsive ─────────────────────────────── */

@media (max-width: 900px) {
  .app {
    flex-direction: column-reverse;
    padding: 0;
    gap: 0;
  }
  .panel-chat {
    width: 100%;
    min-width: unset;
    max-height: 50vh;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border-glass);
    box-shadow: none;
  }
  .panel-preview { padding: 12px; }
  .slide-nav { bottom: 8px; padding: 6px 10px; }

  .sidebar {
    position: fixed;
    top: 10px;
    left: 10px;
    bottom: 10px;
    z-index: 7000;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 0 var(--specular);
  }

  .sidebar-toggle { top: 8px; left: 8px; }

  /* Touch-friendly targets */
  .sidebar-item { padding: 14px 12px; }
  .folder-header { padding: 12px 8px; min-height: 44px; }
  .action-chip { padding: 8px 14px; font-size: 12px; }
  .btn-send { width: 48px; height: 48px; }
  .slide-nav-controls button,
  .btn-fullscreen { width: 36px; height: 36px; }
}
