﻿/* ========================================================
   KinSoft AI - Ultra-Slim Studio CSS
   Strict Height Reductions, Zero Clutter, Mobile Perfect
   ======================================================== */

:root {
  --header-height: 48px;
}

/* App Header - 48px Minimal Height */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.app-header-inner {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}
.app-header-start { display: flex; align-items: center; gap: 8px; }
.app-header-end { display: flex; align-items: center; gap: 6px; }

.sidebar-toggle {
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  background: transparent; border: 1px solid var(--border); padding: 5px;
  cursor: pointer; border-radius: 4px;
}
.sidebar-toggle span { display: block; width: 16px; height: 2px; background: var(--text); }

.brand { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 0.9rem; }
.brand-mark { width: 22px; height: 22px; border-radius: 4px; }
.brand-sub { color: var(--accent); }
.page-title { display: none !important; }

.credits-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 12px; padding: 2px 7px; font-size: 0.74rem; font-weight: 600;
}
.ctrl-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 4px;
  background: var(--surface-muted); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
}
.back-btn { font-size: 0.72rem; padding: 2px 6px; height: 26px; }

/* Layout */
.app-layout { display: flex; min-height: calc(100vh - var(--header-height)); position: relative; }

/* Sidebar - Desktop */
.app-sidebar {
  width: 180px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 8px 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  z-index: 40;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 6px; }
.sidebar-link {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border-radius: 5px;
  color: var(--text-muted); text-decoration: none;
  font-size: 0.8rem; font-weight: 500;
}
.sidebar-link:hover { background: var(--surface-muted); color: var(--text); }
.sidebar-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-icon { font-size: 0.85rem; }

/* Main Area - Zero Wasted Space */
.app-main { flex: 1; min-width: 0; padding: 10px 14px; }
.video-studio-wrap { max-width: 1050px; margin: 0 auto; }

/* Ultra-Slim Mode Tabs (Single Row - Max Height 30px) */
.vs-mode-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.vs-mode-tabs::-webkit-scrollbar { display: none; }

.vs-mode-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.12s;
}
.vs-mode-tab:hover { border-color: var(--accent); color: var(--text); }
.vs-mode-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

/* Panes Grid */
.vs-pane { display: none; }
.vs-pane.active { display: block; }
.vs-two-col {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 10px;
  align-items: start;
}

/* Studio Cards - Tight Padding */
.studio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}
.card-title { display: none !important; }

/* Form Elements - Minimal Vertical Footprint */
.form-group { margin-bottom: 6px; }
.form-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 2px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.form-textarea {
  width: 100%; padding: 5px 8px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text);
  font-family: inherit; font-size: 0.8rem;
  resize: vertical; min-height: 48px;
  line-height: 1.4;
}
.form-textarea:focus { outline: none; border-color: var(--accent); }

.form-select, .form-input {
  width: 100%; padding: 4px 7px;
  height: 28px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text);
  font-family: inherit; font-size: 0.76rem;
}
.form-select:focus, .form-input:focus { outline: none; border-color: var(--accent); }
.char-count { font-size: 0.65rem; color: var(--text-light); text-align: left; margin-top: 1px; }

/* Slim Dropzone */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 5px;
  padding: 6px 10px;
  text-align: center;
  cursor: pointer;
  min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-alt);
}
.dropzone-inner { display: flex; align-items: center; gap: 6px; }
.dropzone-inner svg { width: 16px; height: 16px; color: var(--text-muted); }
.dropzone-inner span:first-of-type { font-size: 0.74rem; font-weight: 500; }
.dropzone-hint { font-size: 0.65rem; color: var(--text-muted); }
.dropzone-preview { position: relative; width: 100%; }
.dropzone-preview img { width: 100%; max-height: 90px; object-fit: contain; border-radius: 4px; }
.dropzone-clear {
  position: absolute; top: 2px; left: 2px;
  background: rgba(0,0,0,0.65); color: #fff;
  border: 0; border-radius: 50%;
  width: 18px; height: 18px; font-size: 0.65rem; cursor: pointer;
}
.hidden { display: none !important; }

/* Buttons - Slim Height */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 4px 10px; height: 30px; border-radius: 5px;
  font-family: inherit; font-size: 0.76rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-full { width: 100%; height: 32px; font-size: 0.8rem; margin-top: 4px; }

/* Cost Banner */
.cost-banner {
  background: var(--surface-muted); color: var(--text-muted);
  border-radius: 5px; padding: 3px 8px;
  font-size: 0.7rem; margin-bottom: 4px;
}
.badge-free { background: #dcfce7; color: #166534; font-size: 0.65rem; padding: 1px 5px; border-radius: 8px; }

/* Output Area */
.vs-output { min-height: 180px; display: flex; align-items: center; justify-content: center; }
.output-placeholder { text-align: center; padding: 15px 5px; color: var(--text-muted); }
.placeholder-icon { font-size: 1.6rem; margin-bottom: 4px; }
.output-placeholder p { font-size: 0.76rem; }
.output-loading { text-align: center; padding: 15px; width: 100%; }
.loading-spinner {
  width: 24px; height: 24px; margin: 0 auto 6px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar { height: 3px; background: var(--border); border-radius: 4px; width: 100%; max-width: 160px; margin: 0 auto; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.3s; }
.output-result { width: 100%; }
.output-actions { display: flex; gap: 6px; margin-top: 6px; }
.output-actions button, .output-actions a { flex: 1; height: 28px; font-size: 0.74rem; }

/* Mobile Drawer (Smooth Full-screen drawer, never floating in the middle) */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5); z-index: 90;
}
.sidebar-backdrop.active { display: block; }

@media (max-width: 768px) {
  .app-sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 240px; height: 100vh;
    z-index: 100; background: var(--surface);
    transform: translateX(100%);
    transition: transform 0.22s ease-out;
    padding: 0;
    box-shadow: -4px 0 20px rgba(0,0,0,0.25);
  }
  .app-sidebar.open { transform: translateX(0); }
  .sidebar-header-mobile {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; border-bottom: 1px solid var(--border);
  }
  .sidebar-close-btn { background: transparent; border: none; font-size: 1.1rem; color: var(--text); cursor: pointer; }
  .sidebar-nav { padding: 8px; gap: 3px; }
  .sidebar-link { padding: 8px 10px; font-size: 0.85rem; }

  .app-main { padding: 6px 8px; }
  .vs-two-col { grid-template-columns: 1fr; gap: 8px; }
  .form-row { grid-template-columns: 1fr; gap: 4px; }
  .studio-card { padding: 8px; }
}

.toast-container { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 999; }
.toast { background: var(--text); color: var(--bg); padding: 5px 12px; border-radius: 4px; font-size: 0.72rem; }
.toast.success { background: #166534; color: #fff; }
.toast.error { background: #dc2626; color: #fff; }


/* Multi-image compact dropzone & thumbs */
.dropzone-compact {
  border: 1.5px dashed var(--border-strong);
  border-radius: 5px;
  padding: 6px 10px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-alt);
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}
.dropzone-compact:hover { border-color: var(--accent); }
.dropzone-compact-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
}
.dropzone-compact-inner svg { color: var(--text-light); }

.uploaded-thumbs-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 8px;
  padding: 4px 0;
  max-width: 100%;
}
.ad-thumb, .thumb-item {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.ad-thumb img, .thumb-item img {
  width: 100% !important;
  height: 100% !important;
  max-width: 58px !important;
  max-height: 58px !important;
  object-fit: cover !important;
  display: block;
}
.ad-thumb-del, .thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pipeline tracker */
.pipeline-tracker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  text-align: right;
}
.track-step {
  font-size: 0.72rem;
  color: var(--text-light);
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--bg-alt);
}
.track-step.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
}
.track-step.done {
  color: #166534;
  background: #dcfce7;
}