:root {
  --bg-color: #0f0f12;       /* Very dark blue/black */
  --card-bg: #1c1c21;        /* Slightly lighter card */
  --text-main: #e0e0e0;      /* Off-white text */
  --text-muted: #8a8a93;     /* Muted gray */
  --accent: #d4af37;         /* Luxury Gold */
  --accent-hover: #b5952f;
  --border: #2d2d35;
  --success: #10b981;
  --error: #ef4444;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  margin: 0;
  padding: 40px 20px;
  line-height: 1.5;
}

h1 {
  font-weight: 300;
  letter-spacing: 1px;
  margin: 0 0 10px;
  color: white;
  text-align: center;
  font-size: 2.2rem;
}

h1 span { color: var(--accent); font-weight: 600; }

.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 40px;
  font-size: 0.95rem;
}

/* --- LAYOUT GRID --- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
}

/* --- TAB MENU STYLES --- */
.tab-menu {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  background: #000;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: var(--accent);
  color: #000;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.tab-btn:hover:not(.active) {
  background: #222;
  color: white;
}

/* --- VIEW SECTIONS --- */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: block;
}

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* --- INPUTS & SELECTS --- */
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

input[type="text"], 
input[type="number"], 
select, 
textarea {
  width: 100%;
  background: #000000;
  border: 1px solid var(--border);
  color: white;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

/* --- FILE UPLOAD STYLING --- */
.file-upload-wrapper {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  transition: border-color 0.2s;
  cursor: pointer;
}
.file-upload-wrapper:hover { border-color: var(--accent); }

input[type="file"] {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* --- BUTTONS --- */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  align-items: center;
}

button {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

button:hover { background: var(--accent-hover); }
button:active { transform: scale(0.98); }
button:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }

#btnPause { background: #f59e0b; color: white; }

/* --- PROGRESS BAR --- */
#progressContainer {
  margin-top: 20px;
  background: #000;
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  display: none; /* Hidden by default */
}

#progressBar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #fff);
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px var(--accent);
}

.status-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* --- EDITOR AREA --- */
#editorArea {
  margin-top: 20px;
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
  padding: 10px;
}

.sub-row {
  display: flex;
  gap: 12px;
  background: var(--card-bg);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
}

.sub-row:hover { border-left-color: var(--accent); }

.sub-times {
  display: flex;
  flex-direction: column;
  width: 140px;
  gap: 5px;
}

.sub-times input {
  padding: 6px;
  font-family: monospace;
  font-size: 0.8rem;
  text-align: center;
  background: #000;
  border: 1px solid var(--border);
}

.sub-text { flex: 1; }
.sub-text textarea {
  height: 100%;
  min-height: 60px;
  resize: vertical;
  border: none;
  background: transparent;
  font-size: 1rem;
  line-height: 1.6;
}

/* --- AEGISUB EDITOR STYLES --- */
.time-nudge-group {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 5px;
}
.nudge-btn {
  background: #333;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px;
  font-size: 0.6rem;
  cursor: pointer;
  border-radius: 4px;
}
.nudge-btn:hover { background: var(--accent); color: black; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: white;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}
.btn-icon:hover { background: #333; }


/* --- FORMATTING TOOLS CSS --- */
.format-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
  padding: 10px;
  background: #1a1a20;
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items: center;
}

.tool-btn {
  background: #2d2d35;
  color: white;
  border: 1px solid #444;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.2s;
}

.tool-btn:hover {
  background: var(--accent);
  color: black;
  border-color: var(--accent);
}

.tool-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 5px;
}

.editor-toolbar {
  display: flex;
  gap: 15px;
  background: #111;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 15px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.hotkey-badge {
  background: #333;
  color: #ffd700;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.75rem;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.preview-box textarea {
  height: 150px;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.app-footer {
  margin-top: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}
