/* Convert Jamack Modern Design System */
:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--primary-hover);
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}
.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand span {
  color: var(--primary);
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-link {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
.nav-link.active {
  color: var(--primary);
  font-weight: 600;
}
.nav-badge-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--warning-light);
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
}
.nav-badge-link:hover {
  background: #fef3c7;
  color: #92400e;
}

/* Hero Section */
.hero {
  padding: 48px 0 32px;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.25;
}
.hero p.lead {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto;
}

/* Mode Switcher Tabs (Segmented Control) */
.mode-tabs-container {
  display: flex;
  justify-content: center;
  margin: 0 auto 28px;
}
.mode-tabs {
  display: inline-flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: center;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 0.96rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.tab-btn:hover {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.6);
}
.tab-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}
.tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  border-color: rgba(37, 99, 235, 0.18);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05);
}
.tab-btn .tab-icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* Workbench Card */
.workbench {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-bottom: 40px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  background: #fafafa;
  transition: all 0.2s ease;
  position: relative;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.dropzone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  color: var(--primary);
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.dropzone h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.dropzone p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 14px;
}
.format-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-gray { background: #e2e8f0; color: #475569; }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-amber { background: var(--warning-light); color: #b45309; }
.badge-red { background: var(--danger-light); color: var(--danger); }

/* Batch Option Bar */
.control-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  width: 100%;
}
.control-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.control-row.secondary-controls {
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.control-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.select-input, .text-input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  text-overflow: ellipsis;
  overflow: hidden;
}
.select-input:focus, .text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
@media (max-width: 680px) {
  .control-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* File Queue Section */
.queue-section {
  margin-top: 28px;
  display: none;
}
.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.queue-header h4 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.queue-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: #ffffff;
}
.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}
.btn-success {
  background: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background: #059669;
  color: #ffffff;
}
.btn-secondary {
  background: #e2e8f0;
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: #cbd5e1;
}
.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 0.82rem;
}
.btn-outline {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

/* Queue Table */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}
.queue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}
.queue-table th {
  background: var(--bg-subtle);
  padding: 12px 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.queue-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.queue-table tr:last-child td {
  border-bottom: none;
}
.file-name {
  font-weight: 600;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
}
.preview-cue {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 10px;
  border-left: 3px solid var(--primary);
}
.cue-time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 4px;
}
.cue-text {
  font-size: 0.92rem;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* Info & Guide Section */
.guide-section {
  margin-bottom: 60px;
}
.guide-heading {
  text-align: center;
  margin-bottom: 32px;
}
.guide-heading h2 {
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.guide-heading p {
  color: var(--text-secondary);
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.guide-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.guide-card p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Modern High-End Footer */
.site-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 56px 0 max(48px, env(safe-area-inset-bottom, 32px));
  font-size: 0.9rem;
  color: var(--text-secondary);
  width: 100%;
}
.footer-top-grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-col-brand .footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.footer-brand-title .brand-accent {
  color: var(--primary);
}
.footer-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 440px;
  margin-bottom: 14px;
}
.footer-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer-col-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}
.footer-links-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-links-list a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.15s;
}
.footer-links-list a:hover {
  color: var(--primary);
}
.footer-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-muted);
}
.footer-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.status-dot-green {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
@media (max-width: 860px) {
  .footer-top-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer-bottom-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Global Suite Bar */
.suite-bar {
  background: #090d16;
  color: #94a3b8;
  font-size: 0.8rem;
  border-bottom: 1px solid #1e293b;
  width: 100%;
}
.suite-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 6px 16px;
  gap: 12px;
}
.suite-title {
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
}
.suite-links {
  display: flex;
  align-items: center;
  gap: 8px;
}
.suite-link {
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}
.suite-link:hover {
  color: #ffffff;
  background: #1e293b;
  border-color: #334155;
}
.suite-link.active {
  color: #38bdf8;
  background: rgba(2, 132, 199, 0.2);
  border-color: rgba(56, 189, 248, 0.4);
  font-weight: 600;
}

@media (max-width: 768px) {
  .suite-bar-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    gap: 6px;
    height: auto;
  }
  .suite-title {
    font-size: 11px;
  }
  .suite-links {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    width: 100%;
    padding-bottom: 4px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .suite-links::-webkit-scrollbar {
    display: none;
  }
  .suite-link {
    font-size: 12px;
    padding: 4px 8px;
    flex-shrink: 0;
  }
}

/* Modern Segmented Mode Tabs */
.mode-tabs {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 26px;
  background: #0f172a;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #1e293b;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  max-width: 100%;
  flex-wrap: wrap;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  font-size: 0.98rem;
  font-weight: 600;
  color: #94a3b8;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.tab-btn .tab-icon {
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}
.tab-btn .tab-text {
  letter-spacing: -0.2px;
}
.tab-btn:hover {
  color: #f8fafc;
  background: rgba(30, 41, 59, 0.8);
  transform: translateY(-1px);
}
.tab-btn:hover .tab-icon {
  transform: scale(1.12);
}
.tab-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-weight: 700;
}
.tab-btn.active .tab-icon {
  transform: scale(1.15);
}

/* Modern Language Select Box */
.lang-select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 2px 10px 2px 8px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.lang-select-wrapper:hover, .lang-select-wrapper:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.lang-icon {
  font-size: 1rem;
  margin-right: 6px;
  opacity: 0.85;
}
.lang-select {
  background: transparent;
  color: #f1f5f9;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  padding: 6px 4px;
}
.lang-select option {
  background: #0f172a;
  color: #f8fafc;
  padding: 8px;
}

/* RTL Support for Arabic */
html[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] .hero, html[dir="rtl"] .workbench, html[dir="rtl"] .dropzone {
  text-align: right;
}
html[dir="rtl"] .lang-icon {
  margin-right: 0;
  margin-left: 6px;
}


.ocr-textarea {
  width: 100%;
  min-height: 48px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: var(--font-sans);
}
.ocr-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .control-bar { grid-template-columns: 1fr; }
  .header-nav .nav-link { display: none; }
  .workbench { padding: 18px; }
  .dropzone { padding: 32px 16px; }
}
