@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ==========================================================================
   StudioKit V2 / Medad Studio — Pure Solid Color Design System (NO GRADIENTS)
   ========================================================================== */

:root {
  /* Light Theme Palette - Pure Solid Colors */
  --st-bg: #F8F9FC;
  --st-sidebar-bg: #FFFFFF;
  --st-panel-bg: #FFFFFF;
  --st-card-bg: #FFFFFF;
  
  --st-primary: #EC4899;       /* Solid Pink */
  --st-primary-hover: #DB2777;
  --st-accent-indigo: #4F46E5; /* Solid Indigo Primary */
  --st-accent-indigo-hover: #4338CA;
  --st-accent-indigo-soft: #EEF2FF;
  
  --st-text-main: #0F172A;
  --st-text-muted: #64748B;
  --st-text-subtle: #94A3B8;
  
  --st-border: #E2E8F0;
  --st-border-strong: #CBD5E1;
  
  --st-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --st-font-mono: 'JetBrains Mono', monospace;

  --st-shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.04);
  --st-shadow-card: 0 4px 20px rgba(15, 23, 42, 0.04);
  --st-shadow-hover: 0 10px 25px rgba(15, 23, 42, 0.08);
}

/* Dark Theme Palette Option */
[data-theme="dark"] {
  --st-bg: #0B0F19;
  --st-sidebar-bg: #111827;
  --st-panel-bg: #111827;
  --st-card-bg: #1F2937;
  
  --st-accent-indigo: #6366F1;
  --st-accent-indigo-hover: #4F46E5;
  --st-accent-indigo-soft: #1E1B4B;
  
  --st-text-main: #F8FAFC;
  --st-text-muted: #94A3B8;
  --st-text-subtle: #64748B;
  
  --st-border: #1F2937;
  --st-border-strong: #374151;
  
  --st-shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.4);
  --st-shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --st-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--st-font-sans);
  font-size: 14px;
  color: var(--st-text-main);
  background-color: var(--st-bg);
  height: 100vh;
  overflow: hidden;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Left Navigation Rail (Desktop)
   ========================================================================== */

.st-nav-rail {
  width: 68px;
  background-color: var(--st-sidebar-bg);
  border-right: 1px solid var(--st-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  z-index: 50;
  flex-shrink: 0;
}

.st-rail-brand-pencil {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background-color: var(--st-accent-indigo);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transition: transform 180ms ease;
  flex-shrink: 0;
}

.st-rail-brand-pencil:hover {
  transform: scale(1.06);
}

.st-rail-tools-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: center;
}

.st-rail-item {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--st-text-muted);
  cursor: pointer;
  transition: all 180ms ease;
  position: relative;
  flex-shrink: 0;
}

.st-rail-item:hover {
  background-color: var(--st-bg);
  color: var(--st-text-main);
}

.st-rail-item.active {
  background-color: var(--st-accent-indigo-soft);
  color: var(--st-accent-indigo);
}

.st-rail-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  width: 4px;
  height: 24px;
  background-color: var(--st-accent-indigo);
  border-radius: 0 4px 4px 0;
}

.st-rail-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 58px;
  background-color: #0F172A;
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
  transform: translateX(-4px);
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.st-rail-item[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* ==========================================================================
   Header & App Shell
   ========================================================================== */

.st-app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.st-top-header {
  height: 60px;
  background-color: var(--st-sidebar-bg);
  border-bottom: 1px solid var(--st-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.st-project-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--st-text-main);
  text-decoration: none;
}

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

.st-theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: var(--st-bg);
  border: 1px solid var(--st-border);
  color: var(--st-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 150ms ease;
}

.st-theme-toggle-btn:hover {
  color: var(--st-text-main);
  border-color: var(--st-accent-indigo);
}

.st-btn-ghost {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background-color: var(--st-bg);
  border: 1px solid var(--st-border);
  color: var(--st-text-main);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background 150ms ease;
}

.st-btn-ghost:hover {
  background-color: var(--st-border);
}

/* Studio Workspace */
.st-studio-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.st-control-panel {
  width: 340px;
  background-color: var(--st-sidebar-bg);
  border-right: 1px solid var(--st-border);
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

.st-tool-header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--st-text-main);
}

.st-tool-header-desc {
  font-size: 13px;
  color: var(--st-text-muted);
  line-height: 1.4;
  margin-top: 4px;
}

.st-dropzone-box {
  background-color: var(--st-bg);
  border: 1.5px dashed var(--st-border-strong);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 180ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.st-dropzone-box:hover, .st-dropzone-box.dragover {
  border-color: var(--st-accent-indigo);
  background-color: var(--st-accent-indigo-soft);
}

.st-dropzone-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--st-card-bg);
  border: 1px solid var(--st-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--st-text-muted);
}

.st-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.st-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--st-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.st-select-custom, .st-input-custom {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--st-border);
  background-color: var(--st-bg);
  padding: 0 12px;
  font-family: var(--st-font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--st-text-main);
  outline: none;
}

/* Primary Action Button */
.st-btn-action-primary {
  height: 46px;
  border-radius: 12px;
  background-color: var(--st-accent-indigo);
  color: white;
  font-family: var(--st-font-sans);
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
  transition: all 180ms ease;
  margin-top: auto;
}

.st-btn-action-primary:hover {
  background-color: var(--st-accent-indigo-hover);
  transform: translateY(-1px);
}

/* Right Main Canvas */
.st-main-canvas {
  flex: 1;
  background-color: var(--st-bg);
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  overflow-y: auto;
}

.st-canvas-preview-card {
  background-color: var(--st-card-bg);
  border: 1px solid var(--st-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--st-shadow-card);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.st-canvas-preview-card img, .st-canvas-preview-card svg {
  max-width: 90%;
  max-height: 440px;
  object-fit: contain;
}

.st-palette-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.st-swatch-box {
  background-color: var(--st-card-bg);
  border: 1px solid var(--st-border);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
}

.st-swatch-rect {
  height: 60px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.st-swatch-code {
  font-family: var(--st-font-mono);
  font-weight: 600;
  font-size: 13px;
}

/* Interactive Before/After Split Slider */
.ba-slider-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  height: 440px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  user-select: none;
  margin: 0 auto;
  border: 1px solid var(--st-border);
}

.ba-img-after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ba-img-before-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  border-right: 2px solid white;
}

.ba-img-before {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.ba-slider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 50%;
  background-color: white;
  color: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  cursor: ew-resize;
  z-index: 30;
}

/* ==========================================================================
   Mobile Responsiveness Media Queries (Screen Width <= 768px)
   ========================================================================== */

@media (max-width: 768px) {
  body {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    padding-bottom: 64px; /* Space for fixed bottom rail */
  }

  /* Fixed Bottom Navigation Rail on Mobile */
  .st-nav-rail {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    flex-direction: row;
    padding: 0 16px;
    border-right: none;
    border-top: 1px solid var(--st-border);
    justify-content: space-around;
    align-items: center;
    background-color: var(--st-sidebar-bg);
    z-index: 200;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  }

  .st-rail-brand-pencil {
    display: none; /* Hide brand pencil inside bottom rail */
  }

  .st-rail-tools-list {
    flex-direction: row;
    gap: 4px;
    width: 100%;
    justify-content: space-around;
  }

  .st-rail-item {
    width: 40px;
    height: 40px;
  }

  .st-rail-item.active::before {
    display: none;
  }

  .st-rail-item[data-tooltip]::after {
    display: none;
  }

  .st-app-container {
    height: auto;
    overflow: visible;
  }

  .st-top-header {
    height: 54px;
    padding: 0 16px;
  }

  /* Hide crowded Landing Page button in mobile top header */
  .st-top-header .st-btn-ghost {
    display: none !important;
  }

  .st-studio-workspace {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .st-control-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--st-border);
    padding: 16px;
    gap: 16px;
  }

  .st-main-canvas {
    width: 100%;
    padding: 16px;
    gap: 16px;
  }

  .st-canvas-preview-card {
    min-height: 320px;
    padding: 16px;
  }
}
