@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-light: #f7f5f0;
  --bg-panel: rgba(255, 255, 255, 0.85);
  --bg-white: #ffffff;
  --primary: #1a5276;
  --primary-light: #2980b9;
  --primary-glow: rgba(26, 82, 118, 0.15);
  --secondary: #e67e22;
  --secondary-light: #f0a35c;
  --accent: #27ae60;
  --accent-light: #a8e6cf;
  --warm: #d4a574;
  --warm-light: #f5e6d3;
  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --text-dark: #1a365d;
  --border: rgba(0, 0, 0, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: 'Noto Sans TC', 'Outfit', sans-serif;
  background-color: var(--bg-light);
  color: var(--text-main);
  background-image:
    linear-gradient(rgba(212, 165, 116, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 165, 116, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Global form elements fix (override inline dark-theme remnants) ── */

input, select, textarea {
  color: var(--text-main) !important;
  background: var(--bg-light) !important;
  border: 1px solid var(--border) !important;
  font-family: 'Noto Sans TC', 'Outfit', sans-serif;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.7;
}

select option {
  background: var(--bg-white);
  color: var(--text-main);
}

/* Buttons should NOT be overridden */

input[type="submit"], input[type="button"], input[type="reset"],
input[type="file"], input[type="checkbox"], input[type="radio"],
input[type="range"], input[type="color"] {
  background: revert !important;
  color: revert !important;
  border: revert !important;
}

/* Number input spinners */

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
}

/* Labels */

label {
  color: var(--text-muted);
}

/* Auth page (dark login) keeps its own palette */

.auth-page-dark input, .auth-page-dark select, .auth-page-dark textarea {
  color: #fff !important;
  background: rgba(255,255,255,0.05) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
}

.auth-page-dark input::placeholder, .auth-page-dark textarea::placeholder {
  color: rgba(255,255,255,0.4) !important;
}

.auth-page-dark label {
  color: #aaa;
}

/* Glass / Card panels */

.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 500;
  font-family: 'Noto Sans TC', 'Outfit', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--glass-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-secondary {
  background: rgba(230, 126, 34, 0.1);
  color: var(--secondary);
  border: 1px solid rgba(230, 126, 34, 0.3);
}

.btn-secondary:hover {
  background: rgba(230, 126, 34, 0.2);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Canvas Editor Area */

.canvas-container {
  position: relative;
  width: 100%;
  height: 600px;
  background: #fafaf8;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
  cursor: crosshair;
  border: 1px solid var(--border);
}

.canvas-container canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.layout-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  height: 100vh;
}

.sidebar {
  padding: 2rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--bg-white);
}

.main-content {
  padding: 2rem;
  overflow-y: auto;
  background: var(--bg-light);
}

.mobile-header {
  display: none;
}

.sidebar-overlay {
  display: none;
}

.mobile-close-btn {
  display: none;
}

@media (max-width: 768px) {
  .layout-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
    overflow: hidden;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    border-right: none;
    border-radius: 0;
  }
  
  .sidebar.mobile-open {
    left: 0;
  }

  .mobile-close-btn {
    display: block;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .sidebar-overlay.mobile-open {
    opacity: 1;
    visibility: visible;
  }

  .main-content {
    padding: 1rem;
    padding-top: 76px; /* Space for mobile header */
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 60px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  }

  .quote-grid {
    grid-template-columns: 1fr !important;
  }
  .quote-header {
    flex-direction: column;
    align-items: stretch !important;
  }
}

.quote-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

.quote-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.module-card {
  padding: 1.5rem;
  border-radius: 16px;
  background: var(--bg-white);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
  box-shadow: var(--card-shadow);
}

.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.1);
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(39, 174, 96, 0.1);
  color: var(--accent);
  border: 1px solid rgba(39, 174, 96, 0.2);
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  transition: all 0.3s ease;
}

.step.active .step-number {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 15px var(--primary-glow);
}

.step-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.step.active .step-label {
  color: var(--text-main);
  font-weight: 500;
}

.floating-tools {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 20px;
  z-index: 10;
}

/* Animations */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-pulse-slow {
  animation: pulse-slow 3s ease-in-out infinite;
}

@keyframes pulse-slow {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@media print {
  .no-print, .sidebar {
    display: none !important;
  }
  body, .glass-panel, .card {
    background: white !important;
    color: black !important;
    border: none !important;
    box-shadow: none !important;
  }
  h2, h3, h4, p, label, input, textarea {
    color: black !important;
  }
  .layout-grid {
    display: block !important;
  }
  .main-content {
    padding: 0 !important;
  }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease forwards;
}
