/* ==========================================================================
   CYANOTYPER - Design System & Stylesheet
   ========================================================================== */

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

:root {
  /* Color Palette - Dark Mode (Default) */
  --bg-color: #08090c;
  --panel-bg: #101318;
  --panel-border: rgba(255, 255, 255, 0.22);
  --panel-hover-border: rgba(0, 255, 255, 0.5);

  --card-bg: #161b22;
  --card-border: rgba(255, 255, 255, 0.06);
  --card-active-bg: rgba(0, 255, 255, 0.08);
  --card-active-border: #00ffff;

  --text-main: #f0f4f8;
  --text-muted: #8b98a5;
  --text-subtle: #586573;

  /* Primary Accent Color is #00FFFF */
  --accent-cyan: #00ffff;
  --accent-cyan-hover: #33ffff;
  --accent-blue-gradient: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);

  --cyanotype-blue: #003B5C;
  --cyanotype-mid: #1d4e89;
  --cyanotype-light: #e6f3ff;

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

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-cyan: 0 4px 20px rgba(0, 255, 255, 0.3);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  --paper-bg: #f7f5f0;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-color: #f3f5f8;
  --panel-bg: #ffffff;
  --panel-border: rgba(0, 0, 0, 0.2);
  --panel-hover-border: rgba(0, 162, 232, 0.4);

  --card-bg: #f8fafc;
  --card-border: rgba(0, 0, 0, 0.08);
  --card-active-bg: rgba(0, 162, 232, 0.08);
  --card-active-border: #0099dd;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;

  --accent-cyan: #0099dd;
  --accent-cyan-hover: #0082be;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --shadow-cyan: 0 4px 20px rgba(0, 153, 221, 0.2);

  --paper-bg: #ffffff;
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

.script-font {
  font-family: 'Caveat', cursive;
  font-weight: 200;
  font-size: 32px;
}

/* Layout Container */
.app-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
}

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

/* CYANOTYPER Heading set to 'Courier Prime' 400 */
.brand-titles h1 {
  font-family: 'Courier Prime', monospace;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-main);
  line-height: 1.1;
}

.brand-titles p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.header-tagline {
  font-size: clamp(16px, 2.5vw, 28px);
  color: var(--text-main);
  font-weight: 100;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.2;
}

.theme-toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.theme-icon {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

/* Toggle Switch Component */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #242c37;
  transition: var(--transition-normal);
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--accent-cyan);
  transition: var(--transition-normal);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.6);
}

input:checked+.slider {
  background-color: #00d2ff;
}

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

/* Main Content Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  flex: 1;
}

/* Sidebar Controls Panel */
.sidebar-panel {
  background: var(--panel-bg);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: var(--shadow-md);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Segmented Control / Tabs */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.segmented-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.segmented-btn.active {
  background: var(--accent-cyan);
  color: #000000;
  box-shadow: var(--shadow-cyan);
}

/* Dropzone Box */
.upload-dropzone {
  border: 2px dashed var(--card-active-border);
  background: rgba(0, 210, 255, 0.02);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: var(--transition-normal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  background: rgba(0, 210, 255, 0.07);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.upload-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0, 210, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  margin-bottom: 10px;
  background: rgba(0, 210, 255, 0.05);
}

.upload-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

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

.botanical-bg-art {
  position: absolute;
  right: -10px;
  bottom: -10px;
  opacity: 0.18;
  pointer-events: none;
  width: 110px;
  height: 110px;
}

/* Bulk Mode Container Above Preview Window */
.bulk-container {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bulk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.bulk-thumbs-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.bulk-thumb-item {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.bulk-thumb-item.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.bulk-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bulk-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Page Layout Options Grid */
.layout-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.layout-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
  min-height: 96px;
}

.layout-card:hover {
  border-color: var(--panel-hover-border);
}

.layout-card.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 4px 18px rgba(0, 255, 255, 0.4);
}

.layout-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: var(--transition-fast);
}

.layout-card.active .layout-icon-box {
  color: #000000;
}

.layout-card span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  transition: var(--transition-fast);
}

.layout-card.active span {
  color: #000000;
  font-weight: 700;
}

/* Solid Cyan Breathing Glow Quick Action Button */
.quick-action-btn {
  width: 100%;
  background: var(--accent-cyan);
  border: none;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  animation: cyanPulseGlow 3s infinite alternate ease-in-out;
}

@keyframes cyanPulseGlow {
  0% {
    box-shadow: 0 4px 14px rgba(0, 210, 255, 0.35), 0 0 6px rgba(0, 210, 255, 0.2);
  }

  100% {
    box-shadow: 0 8px 30px rgba(0, 210, 255, 0.85), 0 0 24px rgba(0, 210, 255, 0.6);
  }
}

.quick-action-btn:hover {
  background: var(--accent-cyan-hover);
  transform: translateY(-2px) scale(1.01);
}

/* Floating Sparkle Stars */
.btn-sparkle {
  position: absolute;
  font-size: 14px;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 0 14px #00d2ff;
  pointer-events: none;
  animation: sparkleTwinkle 2s infinite ease-in-out alternate;
  z-index: 2;
}

.sparkle-1 {
  top: 8px;
  right: 60px;
  font-size: 12px;
  animation-delay: 0s;
}

.sparkle-2 {
  bottom: 8px;
  left: 16px;
  font-size: 14px;
  animation-delay: 0.7s;
}

.sparkle-3 {
  top: 14px;
  left: 170px;
  font-size: 10px;
  animation-delay: 1.4s;
}

@keyframes sparkleTwinkle {
  0% {
    transform: scale(0.6) rotate(0deg);
    opacity: 0.3;
  }

  100% {
    transform: scale(1.35) rotate(25deg);
    opacity: 1;
  }
}

.quick-action-content {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.quick-action-text h4 {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.quick-action-text p {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
}

.arrow-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Advanced Settings Accordion */
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 12px 0 4px 0;
  border-top: 1px solid var(--panel-border);
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.accordion-title h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.accordion-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.accordion-icon {
  transition: transform var(--transition-normal);
  color: var(--text-muted);
}

.accordion-header.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.accordion-content.open {
  max-height: 800px;
  padding-top: 16px;
}

/* Form Controls */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.control-value {
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 12px;
}

.range-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #242c37;
  outline: none;
  -webkit-appearance: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0, 210, 255, 0.6);
}

.btn-group {
  display: flex;
  gap: 8px;
}

.btn-option {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-fast);
}

.btn-option:hover {
  color: var(--text-main);
  border-color: var(--panel-hover-border);
}

.btn-option.active {
  background: var(--accent-cyan);
  color: #000000;
  border-color: var(--accent-cyan);
}

/* Right Main Viewport Panel */
.viewport-panel {
  background: var(--panel-bg);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
}

.viewport-header {
  display: flex;
  justify-content: center;
}

.view-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 40px;
  padding: 4px;
  gap: 6px;
}

.view-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.view-tab-btn.active {
  background: var(--accent-cyan);
  color: #000000;
  box-shadow: var(--shadow-cyan);
}

/* Cyanotype Notice Banner Directly ABOVE Preview Window */
.preview-top-note {
  background: rgba(0, 210, 255, 0.05);
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.preview-top-note p {
  font-size: 12px;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.4;
}

.top-botanical-svg {
  width: 48px;
  height: 24px;
  color: var(--accent-cyan);
  opacity: 0.6;
  flex-shrink: 0;
}

/* Stage Layout Centering & Multi-Card Grid */
.stage-wrapper {
  flex: 1;
  background: #000000;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  position: relative;
  min-height: 480px;
  gap: 24px;
}

.paper-sheet {
  background-color: var(--paper-bg);
  background-image: radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0);
  background-size: 8px 8px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
  max-width: 100%;
  max-height: 100%;
  min-width: 280px;
  min-height: 360px;
}

/* Multi-Card Bulk Grid Stage */
.grid-stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  width: 100%;
  max-height: 520px;
  overflow-y: auto;
  padding: 8px;
}

.grid-paper-card {
  background-color: var(--paper-bg);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

.grid-card-label {
  font-size: 11px;
  font-weight: 700;
  color: #0077b6;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-dimension-tag {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  color: #0077b6;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 119, 182, 0.2);
}

.sheet-tag-top {
  top: -12px;
}

.sheet-tag-bottom {
  bottom: -12px;
}

.printable-area {
  border: 1.5px dashed #0099dd;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 220px;
  min-height: 300px;
}

.canvas-preview {
  max-width: 100%;
  max-height: 440px;
  min-height: 240px;
  object-fit: contain;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: block;
}

/* Viewport Action Footer Bar */
.viewport-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
}

.export-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #000000;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-cyan);
}

.btn-primary:hover {
  background: var(--accent-cyan-hover);
  transform: translateY(-1px);
}

/* Footer Information Cards */
/* Information & Bio Cards Section Below Heading */
.info-cards-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.footer-card {
  background: var(--panel-bg);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius-xl);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

/* Clickable Bio Avatar Link & Stamp Logo */
.bio-avatar-link {
  text-decoration: none;
  display: block;
}

.bio-avatar {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.bio-avatar-link:hover .bio-avatar {
  border-color: var(--accent-cyan);
  transform: scale(1.06);
  box-shadow: var(--shadow-cyan);
}

.bio-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bio-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.bio-info p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 2px 0 4px 0;
}

.bio-links {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  display: flex;
  gap: 12px;
}

.bio-links a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.bio-links a:hover {
  text-decoration: underline;
}

.privacy-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: var(--text-main);
  flex-shrink: 0;
}

.privacy-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.privacy-info p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.footer-botanical-art {
  position: absolute;
  right: 12px;
  bottom: 0px;
  opacity: 0.15;
  width: 64px;
  height: 84px;
  pointer-events: none;
}

/* Responsiveness */
@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .info-cards-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 16px;
    gap: 16px;
  }

  .app-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  .header-tagline {
    font-size: 20px;
  }
}

/* Support Contact Line */
.support-line {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 16px 0 8px 0;
  border-top: 1px solid var(--panel-border);
  margin-top: 8px;
}

.support-line a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}

.support-line a:hover {
  text-decoration: underline;
}