/* static/css/style.css */

:root {
  --bg: #020617;
  --bg-elevated: #020617;
  --bg-card: #020617;
  --border-soft: #1f2937;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #f97373;
  --success: #22c55e;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-heavy: 0 24px 60px rgba(15, 23, 42, 0.8);
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #111827 0, #020617 40%, #020617 100%);
  color: var(--text);
  min-height: 100vh;
}

/* Layout shell */

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px 22px 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Top bar */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 20%, #38bdf8, #0ea5e9 40%, #020617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.9);
}

.brand-logo span {
  font-weight: 700;
  font-size: 20px;
  color: #020617;
}

.brand-text-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.brand-text-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.chip-status {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(18px);
  color: var(--text-muted);
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.22);
}

/* Sections */

.section {
  display: grid;
  gap: 18px;
}

.section-upload {
  grid-template-columns: minmax(0, 2.4fr) minmax(260px, 1.3fr);
  align-items: stretch;
}

.section-results {
  grid-template-columns: minmax(0, 2.4fr) minmax(260px, 1.3fr);
  align-items: stretch;
}

@media (max-width: 1024px) {
  .section-upload,
  .section-results {
    grid-template-columns: 1fr;
  }
}

/* Generic cards */

.card,
.upload-card,
.options-card,
.schedule-card,
.chat-card {
  background: radial-gradient(circle at top left, #020617, #020617);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: var(--shadow-heavy);
  padding: 16px 18px 18px;
}

/* Titles */

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c7d2fe;
}

.section-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Upload area */

.upload-header {
  margin-bottom: 10px;
}

.upload-dropzone {
  margin-top: 6px;
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.09), rgba(15, 23, 42, 0.98));
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.08s ease, background 0.12s ease;
}

.upload-dropzone.drag-over {
  border-color: var(--accent);
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.16), rgba(15, 23, 42, 0.99));
  transform: translateY(-2px);
}

.upload-icon {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.98);
  font-size: 26px;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.9);
}

.upload-title {
  font-size: 14px;
  font-weight: 500;
}

.upload-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.upload-input {
  display: none;
}

/* File list */

.file-list {
  margin-top: 12px;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.7) transparent;
}

.file-list::-webkit-scrollbar {
  width: 5px;
}
.file-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.7);
  border-radius: 999px;
}

.file-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(30, 64, 175, 0.5);
  font-size: 12px;
  margin-bottom: 6px;
}

.file-ext {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #22c55e22;
  border: 1px solid #22c55e77;
  color: #bbf7d0;
}

.file-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-remove {
  font-size: 14px;
  cursor: pointer;
  color: #fca5a5;
}

/* Buttons */

.btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #020617;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 18px 40px rgba(56, 189, 248, 0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 22px 50px rgba(8, 47, 73, 0.8);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.96);
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.6);
  box-shadow: none;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(15, 23, 42, 1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: none;
}

/* Upload footer */

.upload-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.status-text {
  font-size: 11px;
  color: var(--text-muted);
}

.status-text.ok {
  color: var(--success);
}
.status-text.err {
  color: var(--danger);
}

/* Options panel */

.options-card {
  position: relative;
}

.options-header {
  margin-bottom: 10px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.option-label {
  font-size: 13px;
  font-weight: 500;
}

.option-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.option-input {
  min-width: 90px;
  max-width: 120px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.97);
  color: var(--text);
  padding: 5px 10px;
  font-size: 12px;
  outline: none;
}

.option-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.options-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Switch */

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #111827;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  transition: 0.14s;
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: #e5e7eb;
  border-radius: 999px;
  transition: 0.18s;
}
.switch input:checked + .switch-slider {
  background-color: var(--accent-soft);
  border-color: var(--accent);
}
.switch input:checked + .switch-slider:before {
  transform: translateX(16px);
}

/* Results section */

.card-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.schedule-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text-muted);
}

.schedule-links {
  display: flex;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.schedule-links a {
  color: var(--accent);
  text-decoration: none;
}
.schedule-links a:hover {
  text-decoration: underline;
}

/* Schedule table */

.table-shell {
  margin-top: 8px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), #020617);
  overflow: hidden;
}

.table-scroll {
  max-height: 420px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.7) transparent;
}

.table-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.table-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.7);
  border-radius: 999px;
}

.table-scroll table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
.table-scroll th,
.table-scroll td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(30, 64, 175, 0.5);
  text-align: left;
  white-space: nowrap;
}
.table-scroll th {
  background: rgba(15, 23, 42, 0.98);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 500;
  color: #c7d2fe;
}
.table-scroll tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.94);
}

.empty-state {
  padding: 30px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* Chat */

.chat-card {
  display: flex;
  flex-direction: column;
}

.chat-history {
  margin-top: 8px;
  flex: 1;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), rgba(15, 23, 42, 0.98));
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.7) transparent;
  font-size: 12px;
}

.chat-history::-webkit-scrollbar {
  width: 6px;
}
.chat-history::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.7);
  border-radius: 999px;
}

.chat-bubble {
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-bubble.user {
  align-self: flex-end;
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.6);
}
.chat-bubble.system {
  align-self: flex-start;
  background: rgba(15, 23, 42, 0.98);
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chat-input-area {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-textarea {
  width: 100%;
  min-height: 80px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.98);
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
  resize: vertical;
  outline: none;
}
.chat-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.chat-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.chat-status-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.chat-hint {
  font-size: 10px;
  color: var(--text-muted);
}

.brand-img {
  height: 34px;
  width: auto;
  margin-right: 10px;
}
.brand-text-group {
  display: flex;
  flex-direction: column;
}