/* ═══════════════════════════════════════════
   CORE Converter — Design System
   ═══════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────── */
:root {
  --ocean: #266a7e;
  --ocean-hover: #1e5869;
  --ocean-light: #e6f1f4;
  --ocean-50: rgba(38, 106, 126, 0.06);
  --pumpkin: #d45a1e;
  --maroon: #8c1d40;

  --gray-50: #fafbfc;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --white: #ffffff;
  --bg: #f7f8fa;

  --red-500: #ef4444;
  --red-50: #fef2f2;
  --red-200: #fecaca;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-50: #f0fdf4;
  --green-200: #bbf7d0;
  --amber-500: #f59e0b;
  --amber-50: #fffbeb;
  --amber-200: #fde68a;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;

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

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-700);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--ocean-light);
  color: var(--ocean);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Material Symbols ────────────────────── */
.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 20;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Focus ───────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--ocean);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Header ──────────────────────────────── */
.header {
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.95);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.brand-sep {
  width: 1px;
  height: 20px;
  background: var(--gray-200);
}

.brand-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  letter-spacing: -0.01em;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ocean-light);
  color: var(--ocean);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar.has-photo {
  background: transparent;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-sign-out {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--gray-400);
  text-decoration: none;
  transition: all 150ms ease;
}

.btn-sign-out:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* ── Main ────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Login Screen ────────────────────────── */
.login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-inner {
  text-align: center;
  max-width: 440px;
}

.login-lockup {
  max-width: 340px;
  width: 100%;
  height: auto;
  margin-bottom: 28px;
  animation: fadeIn 0.5s ease 0.1s both;
}

.login-divider {
  width: 48px;
  height: 2px;
  background: var(--gray-200);
  margin: 0 auto 24px;
  border-radius: 1px;
  animation: fadeIn 0.5s ease 0.15s both;
}

.login-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  animation: fadeIn 0.5s ease 0.2s both;
}

.login-desc {
  font-size: 15px;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 28px;
  animation: fadeIn 0.5s ease 0.25s both;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  text-decoration: none;
  cursor: pointer;
  transition: all 150ms ease;
  box-shadow: var(--shadow-xs);
  animation: fadeIn 0.5s ease 0.3s both;
}

.btn-google:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-google:active {
  transform: translateY(0);
}

.login-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--gray-400);
  animation: fadeIn 0.5s ease 0.35s both;
}

/* ── Error Banner ────────────────────────── */
.error-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--red-50);
  border-bottom: 1px solid var(--red-200);
  color: var(--red-500);
  font-size: 13px;
  font-weight: 500;
}

/* ── Workspace ───────────────────────────── */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-panels {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Left Panel (Controls) ───────────────── */
.panel-controls {
  width: 400px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
}

.section-title .material-symbols-rounded {
  font-size: 18px;
}

.section-title-success {
  color: var(--green-600);
}

/* ── Drop Zone ───────────────────────────── */
.drop-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 150ms ease;
  background: var(--white);
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--ocean);
  background: var(--ocean-50);
}

.drop-zone.drag-over {
  border-color: var(--ocean);
  border-style: solid;
  background: var(--ocean-light);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px var(--ocean-50);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: var(--ocean);
  background: var(--ocean-50);
  padding: 16px 20px;
  text-align: left;
}

.dz-icon {
  font-size: 36px;
  color: var(--gray-300);
  margin-bottom: 8px;
  display: block;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 48;
}

.drop-zone:hover .dz-icon,
.drop-zone:focus-visible .dz-icon {
  color: var(--ocean);
}

.dz-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 2px;
}

.dz-sub {
  font-size: 12px;
  color: var(--gray-400);
}

.dz-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dz-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dz-file-info > .material-symbols-rounded {
  color: var(--ocean);
  font-size: 24px;
}

.dz-file-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}

.dz-file-size {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 1px;
}

.dz-file-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  transition: all 150ms ease;
}

.dz-file-remove:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* ── Toggle / Checkbox ───────────────────── */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  user-select: none;
}

.toggle-box {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
  background: var(--white);
}

.toggle-check {
  font-size: 16px;
  color: white;
  opacity: 0;
  transform: scale(0.5);
  transition: all 150ms ease;
}

.toggle-label:hover .toggle-box {
  border-color: var(--ocean);
}

input:checked + .toggle-box {
  background: var(--ocean);
  border-color: var(--ocean);
}

input:checked + .toggle-box .toggle-check {
  opacity: 1;
  transform: scale(1);
}

input:focus-visible + .toggle-box {
  outline: 2px solid var(--ocean);
  outline-offset: 2px;
}

/* ── Convert Button ──────────────────────── */
.btn-convert {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--ocean);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  box-shadow: 0 1px 3px rgba(38, 106, 126, 0.3);
}

.btn-convert:hover:not(:disabled) {
  background: var(--ocean-hover);
  box-shadow: 0 4px 12px rgba(38, 106, 126, 0.35);
  transform: translateY(-1px);
}

.btn-convert:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(38, 106, 126, 0.2);
}

.btn-convert:disabled {
  background: var(--gray-200);
  color: var(--gray-400);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-convert.converting {
  background: var(--ocean-hover);
  cursor: wait;
}

/* ── Spinner ─────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Messages ────────────────────────────── */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  animation: fadeIn 0.2s ease;
}

.msg .material-symbols-rounded {
  margin-top: 1px;
}

.msg-status {
  background: var(--ocean-50);
  color: var(--ocean);
}

.msg-error {
  background: var(--red-50);
  border: 1px solid var(--red-200);
  color: var(--red-500);
}

.msg-warning {
  background: var(--amber-50);
  border: 1px solid var(--amber-200);
  color: var(--amber-500);
}

/* ── Result Actions ──────────────────────── */
.panel-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

.result-buttons {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  text-decoration: none;
  border: none;
}

.btn-primary {
  background: var(--ocean);
  color: white;
}

.btn-primary:hover {
  background: var(--ocean-hover);
}

.btn-outline {
  background: var(--white);
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
}

.btn-outline:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.btn-outline:disabled {
  opacity: 0.5;
  cursor: wait;
}

.drive-success {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--green-600);
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

.drive-success a {
  color: var(--ocean);
  font-weight: 600;
}

/* ── Right Panel (Preview) ───────────────── */
.panel-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
  min-width: 0;
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.preview-bar .material-symbols-rounded {
  font-size: 16px;
}

.preview-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--gray-300);
}

.placeholder-icon {
  font-size: 48px;
  font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 48;
  margin-bottom: 4px;
}

.placeholder-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-400);
}

.placeholder-sub {
  font-size: 13px;
  color: var(--gray-400);
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--white);
}

/* ── Session Expired Screen ──────────────── */
.session-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  animation: fadeIn 0.3s ease;
}

.session-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.session-icon {
  font-size: 48px;
  color: var(--amber-500);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 48;
  margin-bottom: 8px;
}

.session-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

.session-desc {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 12px;
}

/* ── Footer ──────────────────────────────── */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
}

.footer-lockup {
  height: 32px;
  width: auto;
  opacity: 0.55;
}

.footer-sep {
  width: 1px;
  height: 20px;
  background: var(--gray-300);
}

.footer-text {
  font-size: 11px;
  color: var(--gray-400);
  letter-spacing: 0.02em;
}

/* ── Animations ──────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Help Button ─────────────────────────── */
.btn-help {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: var(--white);
  color: var(--gray-500);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-help:hover {
  border-color: var(--ocean);
  color: var(--ocean);
  background: var(--ocean-50);
}

.btn-help .material-symbols-rounded {
  font-size: 18px;
}

/* ── Help Modal ──────────────────────────── */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.help-modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 680px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: helpSlideIn 0.25s ease;
}

@keyframes helpSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.help-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}

.help-title .material-symbols-rounded {
  font-size: 22px;
  color: var(--ocean);
}

.help-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  transition: all 150ms ease;
}

.help-close:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.help-body {
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.help-intro {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.help-intro p {
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.6;
}

.help-download-btn {
  align-self: flex-start;
}

.help-download-btn .material-symbols-rounded {
  font-size: 18px;
}

.help-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-section p {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.6;
}

.help-note {
  font-size: 12px !important;
  color: var(--gray-400) !important;
  font-style: italic;
}

.help-code {
  background: var(--gray-800);
  color: #d4d4d4;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

.help-code code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.help-callouts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.help-callout {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  border-left: 4px solid;
}

.help-callout-info {
  background: #e8f4fa;
  border-color: #52a3cb;
  color: var(--gray-700);
}

.help-callout-warning {
  background: #fff8e6;
  border-color: #ffbf00;
  color: var(--gray-700);
}

.help-callout-error {
  background: #fce8e3;
  border-color: #d5410b;
  color: var(--gray-700);
}

.help-callout-success {
  background: #f0f9e8;
  border-color: #99cc33;
  color: var(--gray-700);
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}

.help-list li {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
}

.help-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  background: var(--ocean);
  border-radius: 50%;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 900px) {
  .workspace-panels {
    flex-direction: column;
  }

  .panel-controls {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
    overflow-y: visible;
  }

  .panel-preview {
    min-height: 50vh;
  }
}

@media (max-width: 680px) {
  .help-overlay {
    padding: 12px;
  }

  .help-modal {
    max-height: calc(100vh - 24px);
  }

  .help-header {
    padding: 16px 18px;
  }

  .help-body {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    height: 48px;
  }

  .brand-sep,
  .brand-label {
    display: none;
  }

  .user-name {
    display: none;
  }

  .panel-controls {
    padding: 20px 16px;
  }

  .drop-zone {
    padding: 24px 16px;
  }

  .result-buttons {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }

  .login-heading {
    font-size: 20px;
  }

  .login-lockup {
    max-width: 280px;
  }
}
