/* New UI theme: Clean, modern, responsive, with glass accents and animations */

:root {
  --bg: #0b0f1a;
  --bg-2: #0e1422;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.08);
  --surface-3: rgba(255, 255, 255, 0.12);
  --text: #f5f7fb;
  --muted: #a8b3c2;
  --accent: #7c9cff;
  --accent-2: #22d3ee;
  --danger: #ff6b6b;
  --success: #22c55e;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

/* Page & container with enhanced background */
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  background-image: 
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%),
    radial-gradient(circle at 15% 50%, rgba(124, 156, 255, 0.08) 0%, transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(34, 211, 238, 0.05) 0%, transparent 30%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

.app { max-width: 1320px; margin: 0 auto; padding: 92px 20px 24px; }

/* Sticky topbar with glass look */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 20px; z-index: 10;
  background: rgba(11, 15, 26, 0.55);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar input, .topbar select { min-width: 220px; }
.topbar #status { margin-left: auto; font-size: 0.95rem; color: var(--muted); }

/* Search container */
.search-container {
  position: relative;
  min-width: 220px;
}

.search-container input {
  padding-right: 36px;
}

.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* Compact header */
.compact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.compact-header h1 {
  margin: 0; 
  font-size: 1.4rem; 
  letter-spacing: 0.3px;
  color: #e8ecff;
  pointer-events: none;
}

.auth-buttons {
  display: flex;
  gap: 10px;
}

.btn-auth {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn-auth:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Three-column layout */
.layout { display: grid; grid-template-columns: 280px 1fr 340px; gap: 16px; }
.left, .center, .right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* Headings */
.left h3, .right h3 { margin: 6px 0 10px 0; font-weight: 600; letter-spacing: 0.2px; }

/* Inputs & buttons */
input, select, textarea, button {
  font: inherit; color: var(--text);
}
input, select, textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.3s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.25);
}

/* Buttons */
button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border: 0; color: #051021; font-weight: 600;
  padding: 10px 14px; border-radius: 12px; cursor: pointer;
  transition: transform 0.05s ease, filter 0.2s ease;
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }
button[disabled] { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #051021;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn-action {
  background: rgba(124, 156, 255, 0.2);
  color: #e8ecff;
}

.btn-export {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn-save {
  background: var(--success);
  color: #051021;
}

/* Editor */
.editor-controls { display: grid; grid-template-columns: 1fr 140px 140px auto auto; gap: 10px; margin-bottom: 10px; }
.editor {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 12px; min-height: 520px; padding: 16px; line-height: 1.7;
  color: #f2f6ff; overflow: auto; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.prompt-area textarea {
  width: 100%; min-height: 110px; margin-top: 12px;
  background: rgba(0,0,0,0.3);
}

.bottom-controls { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* Left column */
#chapters {
  list-style: none; padding: 0; margin: 10px 0 14px 0; max-height: 310px; overflow: auto;
}
#chapters li {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  cursor: pointer; transition: all 0.3s ease;
}
#chapters li:hover { background: var(--surface-3); border-color: rgba(255,255,255,0.18); transform: translateX(3px); }
#chapters li .badge { background: rgba(124,156,255,0.2); color: #dfe6ff; padding: 2px 8px; border-radius: 999px; font-size: 12px; }

/* Animated lists */
.animated-list > * {
  transition: all 0.3s ease;
}

.animated-list > *:hover {
  transform: translateX(3px);
}

/* Characters */
#characters > div {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
#characters button { background: rgba(124,156,255,0.2); color: #e8ecff; }
#characters button:hover { filter: brightness(1.15); }

/* Right column */
.manga-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.manga-panels { margin-top: 10px; display: grid; gap: 10px; }
#panels { margin-top: 10px; display: grid; gap: 10px; }
#panels > div {
  background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
  transition: all 0.3s ease;
}
#panels > div:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
#panels .panelDesc {
  margin-top: 6px; background: rgba(255,255,255,0.04);
  border: 1px dashed rgba(255,255,255,0.15); border-radius: 8px; padding: 8px;
}

#log {
  max-height: 220px; overflow: auto; background: rgba(0,0,0,0.35);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px; color: var(--muted);
}

/* Resources */
.resources { margin-top: 12px; }
.res-list { list-style: none; padding: 0; margin: 6px 0 0 0; display: grid; gap: 6px; }
.res-list li, .res-list a {
  color: #d7def5; text-decoration: none; font-size: 0.95rem;
}
.res-list a:hover { text-decoration: underline; }

/* Footer */
footer { margin-top: 18px; font-size: 0.95rem; color: var(--muted); text-align: center; }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr; }
  .right { order: 3; }
  .left { order: 2; }
  .center { order: 1; }
  .editor-controls { grid-template-columns: 1fr 1fr; }
  .topbar input, .topbar select { min-width: 160px; }
  .manga-tools { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app { padding: 92px 12px 16px; }
  .editor { min-height: 420px; }
  button { width: 100%; }
}
