/* =====================================================
   INSTAGRAM KARUSSELL MAKER — Styles
   ===================================================== */

:root {
  --bg: #0f0f13;
  --bg-panel: #1a1a22;
  --bg-card: #22222e;
  --bg-input: #2a2a38;
  --border: #33334a;
  --border-focus: #E1306C;
  --text-primary: #f0f0f5;
  --text-secondary: #9090b0;
  --text-muted: #606080;
  --accent: #E1306C;
  --accent-2: #833AB4;
  --accent-3: #F77737;
  --gradient: linear-gradient(135deg, #E1306C, #833AB4, #F77737);
  --gradient-soft: linear-gradient(135deg, rgba(225,48,108,0.15), rgba(131,58,180,0.15));
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-hover: 0 8px 40px rgba(225,48,108,0.25);
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* =====================================================
   HEADER
   ===================================================== */

.app-header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 18px 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.logo-text {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.5px;
}

.logo-text strong {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-sub {
  color: var(--text-secondary);
  font-size: 14px;
  flex: 1;
}

/* Settings Button im Header */
.btn-settings {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-settings:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.btn-settings i {
  font-size: 15px;
  transition: transform 0.4s ease;
}

.btn-settings:hover i {
  transform: rotate(60deg);
}

.settings-label {
  font-weight: 500;
}

/* API Status Dot */
.api-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition);
  flex-shrink: 0;
}

.api-status-dot.active {
  background: #4caf50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

.api-status-dot.warning {
  background: #ff9800;
  box-shadow: 0 0 6px rgba(255, 152, 0, 0.6);
}

/* Settings Modal */
.modal-settings {
  max-width: 460px;
}

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

.settings-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.settings-section-title i {
  color: var(--accent);
}

.settings-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.api-key-status {
  font-size: 12px;
  min-height: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.api-key-status.ok { color: #4caf50; }
.api-key-status.err { color: #e53935; }
.api-key-status.warn { color: #ff9800; }

.hint-link {
  color: var(--accent);
  text-decoration: none;
}

.hint-link:hover {
  text-decoration: underline;
}

/* =====================================================
   MAIN LAYOUT
   ===================================================== */

.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  align-items: start;
}

/* =====================================================
   PANELS
   ===================================================== */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title i {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* =====================================================
   FORM ELEMENTS
   ===================================================== */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group label i {
  color: var(--accent);
  font-size: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group.half { margin-bottom: 0; }

.badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-required {
  background: rgba(225,48,108,0.2);
  color: var(--accent);
}

/* Inputs */
input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 11px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  resize: vertical;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(225,48,108,0.12);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239090b0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

select option {
  background: var(--bg-card);
}

.hint {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 5px;
  display: block;
}

.input-with-toggle {
  position: relative;
}

.input-with-toggle input {
  padding-right: 44px;
}

/* Range Input */
.range-input {
  width: 100%;
  height: 4px;
  background: var(--border);
  border: none;
  border-radius: 2px;
  padding: 0;
  cursor: pointer;
  accent-color: var(--accent);
  margin-bottom: 4px;
}

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

/* Color Input */
.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  transition: border-color var(--transition);
}

.color-input-wrap:focus-within {
  border-color: var(--accent);
}

.color-input-wrap input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
}

.color-input-wrap input[type="text"] {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 13px;
  font-family: monospace;
}

.color-input-wrap input[type="text"]:focus {
  box-shadow: none;
}

/* =====================================================
   UPLOAD ZONE
   ===================================================== */

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(225,48,108,0.05);
}

.upload-icon {
  font-size: 28px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
}

.upload-zone p {
  font-size: 13px;
  color: var(--text-secondary);
}

.upload-zone .link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.upload-zone small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.upload-preview {
  position: relative;
  width: 100%;
}

.upload-preview img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.btn-remove-img {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #e53935;
  color: white;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition);
}

.btn-remove-img:hover { transform: scale(1.15); }

/* =====================================================
   OVERLAY OPTIONS
   ===================================================== */

.overlay-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.overlay-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 54px;
}

.overlay-option input[type="radio"] { display: none; }

.overlay-preview {
  width: 100%;
  height: 38px;
  border-radius: 6px;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
  display: block;
  position: relative;
  overflow: hidden;
}

.overlay-option.active .overlay-preview,
.overlay-option:has(input:checked) .overlay-preview {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(225,48,108,0.3);
}

.dark-overlay { background: rgba(0,0,0,0.6); }
.light-overlay { background: rgba(255,255,255,0.7); }
.gradient-overlay { background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%); }
.blur-overlay { background: rgba(0,0,0,0.3); backdrop-filter: blur(8px); }
.no-overlay { background: transparent; border-style: dashed; }

/* =====================================================
   BUTTONS
   ===================================================== */

.btn-generate {
  width: 100%;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  margin-top: 8px;
  letter-spacing: 0.2px;
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-generate:active {
  transform: translateY(0);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.input-with-toggle .btn-icon {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
}

.btn-action {
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all var(--transition);
}

.btn-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(225,48,108,0.35);
}

.btn-action.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-action.btn-secondary:hover {
  border-color: var(--accent);
  box-shadow: none;
}

.btn-action.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-action.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: none;
}

.btn-action.btn-primary {
  background: var(--gradient);
}

.btn-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}

.btn-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* =====================================================
   PREVIEW PANEL
   ===================================================== */

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-header .panel-title {
  margin-bottom: 0;
}

.preview-actions {
  display: flex;
  gap: 8px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  width: 80px;
  height: 80px;
  background: var(--gradient-soft);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 36px;
}

.empty-icon i {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.7;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-state p {
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.loading-state small {
  color: var(--text-muted);
}

/* =====================================================
   SLIDE NAVIGATOR
   ===================================================== */

.slide-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.slide-counter {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: center;
}

/* =====================================================
   SLIDE CANVAS (Instagram Format 1:1)
   ===================================================== */

.slide-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.slide-canvas {
  width: 480px;
  height: 480px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow: 0 16px 64px rgba(0,0,0,0.6);
  flex-shrink: 0;
}

/* Individuelle Slide */
.slide-item {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.slide-item.active {
  opacity: 1;
  pointer-events: all;
}

.slide-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Overlay Typen */
.slide-overlay {
  position: absolute;
  inset: 0;
}

.overlay-dark .slide-overlay {
  background: rgba(0,0,0,0.55);
}

.overlay-light .slide-overlay {
  background: rgba(255,255,255,0.65);
}

.overlay-gradient-bottom .slide-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
}

.overlay-blur .slide-overlay {
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
}

.overlay-none .slide-overlay {
  display: none;
}

/* Slide Inhalt */
.slide-content {
  position: relative;
  z-index: 2;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slide-number-badge {
  width: 30px;
  height: 30px;
  background: var(--gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  align-self: flex-start;
}

.slide-title {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.slide-body {
  line-height: 1.55;
  opacity: 0.92;
}

.slide-hashtags {
  font-size: 12px;
  opacity: 0.7;
  letter-spacing: 0.2px;
  line-height: 1.6;
}

/* Slide Stile – no background image */
.slide-item.no-bg .slide-bg {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.slide-item.no-bg.style-light .slide-bg {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* =====================================================
   SLIDE THUMBNAILS
   ===================================================== */

.slide-thumbnails {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.slide-thumb {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition), transform var(--transition);
  position: relative;
  flex-shrink: 0;
}

.slide-thumb.active {
  border-color: var(--accent);
  transform: scale(1.08);
}

.slide-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-thumb .thumb-num {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  color: white;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =====================================================
   SLIDE CONTROLS
   ===================================================== */

.slide-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* =====================================================
   CAPTION BOX
   ===================================================== */

.caption-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.caption-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.caption-header i {
  color: var(--accent);
}

.caption-content {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 80px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.caption-content:focus {
  background: rgba(225,48,108,0.04);
}

/* =====================================================
   MODAL
   ===================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: slideUp 0.2s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header h3 i {
  color: var(--accent);
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

/* =====================================================
   TOAST
   ===================================================== */

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  z-index: 2000;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-color: #4caf50; }
.toast.error { border-color: #e53935; }
.toast.info { border-color: var(--accent); }

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1100px) {
  .app-main {
    grid-template-columns: 380px 1fr;
  }
  .slide-canvas {
    width: 420px;
    height: 420px;
  }
}

@media (max-width: 880px) {
  .app-main {
    grid-template-columns: 1fr;
  }
  .slide-canvas {
    width: min(480px, 100%);
    height: min(480px, 100vw - 80px);
  }
  .slide-wrapper {
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .app-header { padding: 14px 16px; }
  .app-main { padding: 16px; }
  .panel { padding: 20px 16px; }
  .slide-canvas {
    width: calc(100vw - 80px);
    height: calc(100vw - 80px);
  }
  .form-row { grid-template-columns: 1fr; }
}

/* =====================================================
   SCROLLBAR
   ===================================================== */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =====================================================
   SELECTION
   ===================================================== */

::selection {
  background: rgba(225,48,108,0.25);
  color: var(--text-primary);
}

/* =====================================================
   UTILITIES
   ===================================================== */

.text-accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
