/* GridCraft - Modern Paper Design Studio Styling */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-panel: #1e293b;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-color: #38bdf8;
  --accent-hover: #0284c7;
  --paper-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
header {
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 20;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
}

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

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-secondary {
  background: #334155;
  color: #f1f5f9;
  border-color: #475569;
}
.btn-secondary:hover {
  background: #475569;
}

.btn-primary {
  background: #0284c7;
  color: #ffffff;
}
.btn-primary:hover {
  background: #0369a1;
}

.btn-accent {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}
.btn-accent:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Studio Workspace Layout */
.studio-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 56px);
}

/* Sidebar Controls */
.sidebar {
  width: 380px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 18px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Pattern Grid Picker */
.pattern-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pattern-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.pattern-btn:hover {
  background: #1e293b;
  border-color: #64748b;
  color: #fff;
}

.pattern-btn.active {
  background: #0369a1;
  border-color: #38bdf8;
  color: #fff;
  font-weight: 600;
}

.pattern-icon {
  font-size: 15px;
  line-height: 1;
}

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

.control-row label {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}

.control-row .val-label {
  color: #38bdf8;
  font-family: monospace;
  font-weight: 600;
}

.form-select, .form-input {
  width: 100%;
  padding: 8px 10px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #f1f5f9;
  font-size: 13px;
  outline: none;
}

.form-select:focus, .form-input:focus {
  border-color: #38bdf8;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid-4col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mini-input {
  text-align: center;
  padding: 6px 4px;
  font-size: 12px;
}

.range-slider {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}

/* Color Palette Dots */
.color-swatches {
  display: flex;
  gap: 8px;
  align-items: center;
}

.swatch-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #334155;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.swatch-btn:hover {
  transform: scale(1.15);
}

.swatch-btn.active {
  border-color: #38bdf8;
  outline: 2px solid #38bdf8;
}

/* Toggle Checkbox */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
  cursor: pointer;
}

.checkbox-row input {
  accent-color: #38bdf8;
  cursor: pointer;
}

/* Preview Viewport */
.viewport-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0b1120;
  position: relative;
  overflow: hidden;
}

.viewport-toolbar {
  height: 40px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.tool-btn:hover {
  background: #334155;
  color: #fff;
}

.paper-container {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: 
    radial-gradient(#1e293b 1px, transparent 1px);
  background-size: 20px 20px;
}

.paper-sheet {
  background: #ffffff;
  box-shadow: var(--paper-shadow);
  border-radius: 2px;
  transition: transform 0.1s ease;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paper-sheet svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Dynamic Parameter Panel Transitions */
.dynamic-params {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px dashed #334155;
  padding-top: 12px;
}

/* Print CSS */
@media print {
  @page {
    size: auto;
    margin: 0mm;
  }
  
  html, body {
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }
  
  header, .sidebar, .viewport-toolbar, .no-print {
    display: none !important;
  }
  
  .studio-layout {
    display: block !important;
    height: 100% !important;
  }
  
  .viewport-area {
    background: #ffffff !important;
    display: block !important;
    height: 100% !important;
  }
  
  .paper-container {
    padding: 0 !important;
    background: #ffffff !important;
    display: block !important;
    height: 100% !important;
  }
  
  .paper-sheet {
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: none !important;
    max-height: none !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  .paper-sheet svg {
    width: 100% !important;
    height: 100% !important;
    page-break-after: avoid;
  }
}
