/* ==========================================================================
   PlayStorePictures Studio — Design System & Styles
   ========================================================================== */

:root {
  --bg-app: #090a10;
  --bg-sidebar: #0f111a;
  --bg-card: rgba(22, 25, 38, 0.7);
  --bg-input: #181b28;
  --bg-hover: #222638;

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-active: rgba(99, 102, 241, 0.4);

  --accent-primary: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --accent-hover: #4f46e5;
  --accent-cyan: #06b6d4;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

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

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   App Shell & Header
   ========================================================================== */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-header {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

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

.badge-pro {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* ==========================================================================
   Main Layout (Sidebar + Stage)
   ========================================================================== */
.main-layout {
  display: flex;
  flex: 1;
  height: calc(100vh - 64px);
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 440px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 3px;
}

.control-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  backdrop-filter: blur(8px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Form inputs */
.form-group {
  margin-bottom: 14px;
}
.form-group:last-child {
  margin-bottom: 0;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.char-count {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.input-text {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.input-text:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Drag and Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-input);
  transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
}

.drop-content svg {
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.drop-text {
  font-size: 0.86rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.accent-link {
  color: #818cf8;
  text-decoration: underline;
  cursor: pointer;
}

.drop-hint {
  font-size: 0.74rem;
  color: var(--text-faint);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.file-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border-subtle);
}

.file-details {
  flex: 1;
  overflow: hidden;
}

.file-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-res {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Theme Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.theme-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.theme-chip:hover {
  border-color: var(--border-active);
  background: var(--bg-hover);
}

.theme-chip.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.theme-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.theme-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
}

.custom-gradient-row {
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.color-pickers {
  display: flex;
  gap: 8px;
}

.color-pickers input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

.color-pickers input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-pickers input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

/* Layout Button Group */
.layout-toggle-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.layout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.layout-btn:hover {
  color: var(--text-main);
}

.layout-btn.active {
  background: var(--bg-hover);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Toggles */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
}

.toggle-info {
  display: flex;
  flex-direction: column;
}

.toggle-label {
  font-size: 0.84rem;
  font-weight: 500;
}

.toggle-desc {
  font-size: 0.74rem;
  color: var(--text-faint);
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  transition: 0.2s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #cbd5e1;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #fff;
}

/* Targets Checklist */
.targets-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.target-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 0.83rem;
}

.target-item:hover {
  border-color: var(--border-active);
}

.target-name {
  flex: 1;
  font-weight: 500;
}

.target-dim {
  font-size: 0.74rem;
  color: var(--text-faint);
}

/* Buttons */
.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-large {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-size: 0.92rem;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.84rem;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
}

.btn-text {
  background: transparent;
  border: none;
  color: #818cf8;
  font-size: 0.78rem;
  cursor: pointer;
}
.btn-text:hover {
  text-decoration: underline;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
}
.btn-icon:hover {
  color: #ef4444;
}

/* ==========================================================================
   Live Stage Viewport
   ========================================================================== */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  overflow: hidden;
}

.stage-toolbar {
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 17, 26, 0.6);
  backdrop-filter: blur(8px);
}

.device-tabs {
  display: flex;
  gap: 6px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.tab-btn.active {
  background: var(--bg-card);
  color: #fff;
  border-color: var(--border-active);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.stage-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.res-badge {
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.preview-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  overflow: auto;
  position: relative;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
  background-size: 24px 24px;
}

.preview-wrapper {
  position: relative;
  max-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.preview-image {
  max-height: calc(100vh - 180px);
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  transition: opacity 0.2s ease;
  display: block;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(9, 10, 16, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-main);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Source Mode Switcher */
.source-switcher {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 12px;
  gap: 4px;
}

.source-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.source-tab:hover {
  color: var(--text-main);
}

.source-tab.active {
  background: var(--bg-hover);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Web URL Capture Container */
.web-capture-container {
  display: flex;
  flex-direction: column;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.url-protocol {
  position: absolute;
  left: 10px;
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0.8;
}

.url-field {
  padding-left: 34px !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
}

.web-options-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.web-device-hint {
  font-size: 0.72rem;
  color: var(--accent-primary);
  font-weight: 500;
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.web-actions {
  display: flex;
  flex-direction: column;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.web-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-main);
  animation: pulse-border 1.5s infinite alternate;
}

.spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes pulse-border {
  from { border-color: rgba(99, 102, 241, 0.25); }
  to { border-color: rgba(99, 102, 241, 0.6); }
}


/* ==========================================================================
   Auth: user chip, sign-in and paywall modals
   ========================================================================== */
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 0;
}

.user-email {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.plan-badge.plan-pro {
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: var(--text-main);
}

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

.modal-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px 24px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.modal-card label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.modal-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 6px;
}

.modal-row {
  display: flex;
  gap: 8px;
}

.modal-row > button {
  flex: 1;
  justify-content: center;
}

.modal-card .btn-primary,
.modal-card .btn-secondary {
  justify-content: center;
  text-decoration: none;
}

.modal-card button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-message {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-message.error { color: #f87171; }
.auth-message.success { color: #34d399; }

.plan-price {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 2px 0 6px;
}

.plan-price small {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-forgot {
  align-self: flex-end;
  font-size: 0.8rem;
}

.auth-captcha {
  display: flex;
  justify-content: center;
  min-height: 65px;
}

.modal-legal {
  font-size: 0.75rem;
  color: var(--text-faint);
  text-align: center;
}

.modal-legal a {
  color: var(--text-muted);
}

.account-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.danger-zone .modal-text {
  font-size: 0.82rem;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 9px 14px;
  cursor: pointer;
}

.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
