/* ==========================================================================
   That One Web Guy - Image Utility
   app.css: Core Design System, Variables, Layout & Global Reset
   ========================================================================== */

:root {
  /* Color Palette: Refined Dark Theme */
  --bg-main: #090d16;
  --bg-surface: #0f172a;
  --bg-card: #151f36;
  --bg-card-hover: #1c2947;
  --bg-input: #101728;
  --bg-overlay: rgba(5, 8, 15, 0.75);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-active: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-sky: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #38bdf8 100%);
  --gradient-accent: linear-gradient(135deg, #f43f5e 0%, #fb923c 100%);
  --gradient-card: linear-gradient(180deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.6) 100%);

  /* Elevations & Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.35);

  /* Spacing & Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Layout dimensions */
  --header-height: 64px;
  --sidebar-left-width: 340px;
  --sidebar-right-width: 330px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 0%, #151d33 0%, #090d16 65%);
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 20px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 50;
  flex-shrink: 0;
}

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

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

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

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-privacy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 10px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 6px var(--accent-emerald);
}

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

/* Main Layout: 3 Columns */
.app-main {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
  height: calc(100vh - var(--header-height));
}

/* Hero Dropzone: Visible when no image is loaded */
.hero-dropzone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.7) 0%, rgba(9, 13, 22, 0.95) 75%);
  backdrop-filter: blur(12px);
  z-index: 40;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.hero-dropzone.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 640px;
  width: 100%;
  padding: 48px 36px;
  background: var(--bg-card);
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.drop-card:hover, .drop-card.drag-over {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.drop-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  color: var(--accent-sky);
  filter: drop-shadow(0 0 16px rgba(56, 189, 248, 0.4));
}

.drop-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.drop-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 13.5px;
}

.drop-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.drop-features {
  display: flex;
  gap: 20px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
}

.drop-feature-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Left Sidebar: Tool Drawer */
.sidebar-left {
  width: var(--sidebar-left-width);
  height: 100%;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 20;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Center Stage */
.stage-center {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background-color: #070a12;
  /* Transparency checkerboard background */
  background-image: 
    linear-gradient(45deg, #101524 25%, transparent 25%),
    linear-gradient(-45deg, #101524 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #101524 75%),
    linear-gradient(-45deg, transparent 75%, #101524 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Right Sidebar: Inspector & Output */
.sidebar-right {
  width: var(--sidebar-right-width);
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 20;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Mobile Tabs Bar */
.mobile-nav-bar {
  display: none;
  height: 52px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  z-index: 60;
  padding: 0 8px;
}

@media (max-width: 960px) {
  .app-main {
    flex-direction: column;
  }
  .sidebar-left, .sidebar-right, .stage-center {
    width: 100% !important;
    height: 100% !important;
  }
  .sidebar-left:not(.tab-active),
  .sidebar-right:not(.tab-active),
  .stage-center:not(.tab-active) {
    display: none !important;
  }
  .mobile-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
  }
}
