/* ==========================================================================
   Nano Banana AI Image Generator - Global Styles
   Aesthetic: Human / Approachable (Airbnb Vibe) with Yellow/Green Accent
   ========================================================================== */

:root {
  /* Apple Pro / High-End Minimal Creative Tool Palette */
  --bg: #F5F5F3;
  --surface: #FFFFFF;
  --canvas: #F5F5F3;
  --fg: #181818;
  --muted: #71717A;
  --border: #E4E4E1;
  --accent: #B8893D;
  --accent-hover: #A0732E;
  --selected-bg: #F4EBDD;

  /* Mappings for older style variables to maintain layout code compatibility */
  --accent-yellow: #B8893D;
  --accent-green: #181818;
  --accent-green-hover: #333333;
  --accent-green-soft: #F4EBDD;
  
  /* Semantic */
  --success: oklch(62% 0.13 145);
  --warn: oklch(72% 0.14 75);
  --danger: oklch(58% 0.18 28);
  
  /* Typography Scale & Hierarchy */
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.03);
}

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

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography elements */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}

p {
  color: var(--muted);
}

/* Header & Nav */
.global-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.logo-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  transition: transform 180ms ease;
}

.logo-container:hover .logo-icon {
  transform: translateY(-1px);
}

.logo-icon svg {
  display: block;
  width: 34px;
  height: 34px;
}

.logo-text {
  font-size: 18px;
  font-weight: 650;
  color: var(--fg);
  line-height: 1;
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
}

.logo-owner {
  margin-left: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--fg);
  background: var(--selected-bg);
}

.nav-link.active {
  color: var(--accent);
  background: var(--selected-bg);
  font-weight: 600;
}

.nav-link svg {
  width: 18px;
  height: 18px;
}

.theme-header-toggle {
  width: auto;
  min-width: 40px;
  min-height: 38px;
  padding: 8px 12px;
  flex: 0 0 auto;
  justify-content: center;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.theme-header-toggle-label {
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

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

.account-status-button {
  max-width: 172px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.account-status-button:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.account-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.1);
}

.account-status-button.connected .account-status-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(57, 145, 91, 0.13);
}

.account-status-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .app-header-actions .nav-links {
    display: none;
  }

  .account-status-button {
    max-width: 132px;
    padding: 0 11px;
  }
}

@media (max-width: 520px) {
  .global-header {
    padding: 0 16px;
  }

  .global-header .logo-owner {
    display: none;
  }
}

/* Layout Core */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-green);
  color: var(--surface);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-green-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

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

.btn-yellow {
  background: var(--accent);
  color: var(--surface);
  box-shadow: var(--shadow-sm);
}

.btn-yellow:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Card base styling */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-yellow {
  background: oklch(96% 0.08 85);
  color: oklch(62% 0.12 85);
}

.badge-green {
  background: var(--accent-green-soft);
  color: var(--accent-green);
}

/* Forms and fields */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--fg);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 137, 61, 0.15);
}

/* Grid controls */
.ratio-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.ratio-option {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 6px;
}

.ratio-option:hover {
  border-color: var(--accent);
  background: var(--selected-bg);
}

.ratio-option.active {
  border-color: var(--accent);
  background: var(--selected-bg);
  color: var(--accent);
  font-weight: 600;
}

.ratio-box {
  border: 2px solid currentColor;
  border-radius: 3px;
  opacity: 0.7;
}

.ratio-box[data-ratio="1:1"] { width: 18px; height: 18px; }
.ratio-box[data-ratio="4:3"] { width: 22px; height: 16px; }
.ratio-box[data-ratio="16:9"] { width: 26px; height: 15px; }
.ratio-box[data-ratio="9:16"] { width: 15px; height: 26px; }

.ratio-label {
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* Model Toggle Pill */
.model-toggle-pill {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 2px;
  border: 1px solid var(--border);
}

.model-pill-option {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  color: var(--muted);
}

.model-pill-option.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.model-pill-option.active[data-model="banana"] {
  background: var(--selected-bg);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Interactive custom upload references style */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: var(--selected-bg);
}

.upload-icon {
  margin-bottom: 8px;
  color: var(--muted);
}

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

.upload-preview-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.upload-thumbnail {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
}

/* Footer credits */
.global-footer {
  text-align: center;
  padding: 40px 20px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

/* Overlay / Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

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

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: oklch(96% 0.005 80);
  color: var(--fg);
}

.modal-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow-y: auto;
}

.modal-img-pane {
  background: oklch(96% 0.005 80);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  position: relative;
}

.modal-img-pane img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-details-pane {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Responsive Adaptation */
@media (max-width: 1024px) {
  .global-header {
    height: 64px;
    padding: 0 16px;
  }
  
  .container {
    padding: 16px;
  }
}

@media (max-width: 768px) {
  .modal-content {
    grid-template-columns: 1fr;
  }
  
  .modal-img-pane {
    min-height: 250px;
  }
}
