/* ==========================================================================
   Louder - Clean & Minimal Dark Theme
   Simple, utilitarian, no excessive gradients or glow
   ========================================================================== */

:root {
  --bg-page: #111215;
  --bg-card: #18191e;
  --bg-subtle: #202227;
  --bg-subtle-hover: #262930;
  --bg-input: #121317;

  --border-subtle: #2b2d35;
  --border-focus: #3b82f6;

  --accent: #3b82f6;
  --accent-primary: var(--accent);
  --accent-hover: #2563eb;
  --accent-active: #1d4ed8;

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --error-bg: #261719;
  --error-border: #59252a;
  --error-text: #f87171;

  --info-bg: #172033;
  --info-border: #1e3a5f;
  --info-text: #93c5fd;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --transition: 0.15s ease;
}

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

button, input, textarea, select {
  font-family: inherit;
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  line-height: 1.5;
}

/* Hidden iframe */
.hidden-frame {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Header */
.app-header {
  text-align: center;
}

.app-title {
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* Main Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
}

.alert-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-content {
  flex: 1;
}

.alert-text {
  word-break: break-word;
}

.alert-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 4px;
  font-size: 14px;
}

.alert-close:hover {
  opacity: 1;
}

.alert-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}

.alert-info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}

/* Form */
#volume-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#volume-form.is-submitting .dropzone,
#volume-form.is-submitting .gain-section {
  pointer-events: none;
  opacity: 0.6;
}

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

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Dropzone */
.dropzone {
  background: var(--bg-subtle);
  border: 1.5px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.dropzone:hover {
  border-color: var(--text-muted);
  background: var(--bg-subtle-hover);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #1c2436;
}

.file-input-hidden {
  display: none;
}

.dropzone-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dropzone-icon-wrap {
  color: var(--text-muted);
}

.dropzone-icon {
  width: 28px;
  height: 28px;
}

.dropzone-primary-text {
  font-size: 14px;
  color: var(--text-primary);
}

.btn-browse {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-browse:hover {
  background: var(--bg-subtle-hover);
  border-color: var(--text-muted);
}

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

/* File Selected State */
.file-selected-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  gap: 12px;
}

.file-icon-box {
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.media-icon {
  width: 20px;
  height: 20px;
}

.file-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: left;
}

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

.btn-remove-file {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-remove-file:hover {
  background: var(--bg-subtle-hover);
  color: var(--text-primary);
}

/* Gain Section */
.gain-section {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  gap: 14px;
}

.gain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gain-stepper-control {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-step {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-step:hover {
  background: var(--bg-subtle-hover);
}

.gain-input-wrapper {
  display: flex;
  align-items: center;
  padding: 0 4px;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
}

#gain-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  width: 44px;
  height: 30px;
  outline: none;
  -moz-appearance: textfield;
  font-variant-numeric: tabular-nums;
}

#gain-input::-webkit-outer-spin-button,
#gain-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.gain-unit {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 3px;
  user-select: none;
}

/* Slider */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#gain-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input);
  outline: none;
  cursor: pointer;
}

#gain-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  cursor: pointer;
}

#gain-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  cursor: pointer;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 2px;
}

/* Presets */
.presets-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

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

.presets-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.preset-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.preset-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Option Row / Checkbox */
.option-row {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.custom-checkbox {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.custom-checkbox .check-icon {
  width: 12px;
  height: 12px;
  color: #ffffff;
  opacity: 0;
}

.checkbox-container:hover .custom-checkbox {
  border-color: var(--text-muted);
}

.checkbox-container input[type="checkbox"]:checked + .custom-checkbox {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-container input[type="checkbox"]:checked + .custom-checkbox .check-icon {
  opacity: 1;
}

.checkbox-label-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.checkbox-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

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

/* Processing Status */
.processing-status {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(147, 197, 253, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.processing-text-wrap {
  display: flex;
  flex-direction: column;
}

.processing-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--info-text);
}

.processing-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Actions */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-submit {
  width: 100%;
  height: 42px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--transition);
}

.btn-submit:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-submit:active:not(:disabled) {
  background: var(--accent-active);
}

.btn-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-submit.is-loading .btn-spinner {
  display: inline-block;
}

.btn-reset {
  width: 100%;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-reset:hover {
  background: var(--bg-subtle-hover);
  color: var(--text-primary);
}

/* Mobile */
@media (max-width: 540px) {
  .card {
    padding: 18px 14px;
  }
}
