/* ============================================
   USA State SVG Icons — Styles
   ============================================ */


/* ===========================================
   THEME — LIGHT (default)
   =========================================== */

[data-theme="light"] {
  --color-brand:          #1a1a2e;
  --color-brand-hover:    #16213e;
  --color-brand-rgb:      26, 26, 46;

  --color-accent:         #fbbc09;
  --color-accent-hover:   #e5ab08;
  --color-accent-text:    #000000;

  --color-bg-page:        #fafaf9;
  --color-bg-surface:     #ffffff;
  --color-bg-muted:       #f5f5f0;

  --color-text:           #1a1a1a;
  --color-text-secondary: #6b6b6b;
  --color-text-muted:     #9a9a9a;

  --color-border:         #e8e8e4;
  --color-border-hover:   #d0d0ca;

  --color-toast-bg:       #1a1a2e;
  --color-toast-text:     #ffffff;

  --color-header-bg:      rgba(255, 255, 255, 0.92);
  --color-modal-bg:       #ffffff;

  --color-btn-primary-bg:    #fbbc09;
  --color-btn-primary-text:  #000000;
  --color-btn-primary-hover: #e5ab08;

  --color-checkbox:        #fbbc09;
}


/* ===========================================
   THEME — DARK (default)
   =========================================== */

[data-theme="dark"] {
  --color-brand:          #ffffff;
  --color-brand-hover:    #e0e0e0;
  --color-brand-rgb:      255, 255, 255;

  --color-accent:         #fbbc09;
  --color-accent-hover:   #e5ab08;
  --color-accent-text:    #000000;

  --color-bg-page:        #121218;
  --color-bg-surface:     #1c1c26;
  --color-bg-muted:       #24242e;

  --color-text:           #e8e8ec;
  --color-text-secondary: #9a9aaa;
  --color-text-muted:     #6a6a7a;

  --color-border:         #2e2e3a;
  --color-border-hover:   #3e3e4e;

  --color-toast-bg:       #2e2e3e;
  --color-toast-text:     #e8e8ec;

  --color-header-bg:      rgba(18, 18, 24, 0.92);
  --color-modal-bg:       #1c1c26;

  --color-btn-primary-bg:    #fbbc09;
  --color-btn-primary-text:  #000000;
  --color-btn-primary-hover: #e5ab08;

  --color-checkbox:        #fbbc09;
}


/* ===========================================
   SHARED TOKENS
   =========================================== */

:root {
  /* --- Typography --- */
  --font-family:    'Google Sans Flex', -apple-system, sans-serif;
  --font-mono:      'Google Sans Flex', monospace;

  /* --- Radii --- */
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-pill:    20px;

  /* --- Shadows --- */
  --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md:      0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg:      0 8px 32px rgba(0, 0, 0, 0.10);

  /* --- Transitions --- */
  --transition:     0.2s ease;
}


/* ===========================================
   RESET
   =========================================== */

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

body {
  font-family: var(--font-family);
  background: var(--color-bg-page);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
}


/* ===========================================
   TOAST NOTIFICATION
   =========================================== */

#copyToast {
  background: var(--color-toast-bg);
  color: var(--color-toast-text);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  font-size: 0.9rem;
  min-width: 260px;
}

#copyToast .toast-body {
  padding: 0.85rem 1rem;
}


/* ===========================================
   HEADER
   =========================================== */

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: var(--color-header-bg);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  width: 32px;
  height: 32px;
  color: var(--color-brand);
}

.header-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

/* Theme Toggle Button */
.theme-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: var(--transition);
}

.theme-toggle:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text);
  background: var(--color-bg-surface);
}

.theme-icon {
  width: 18px;
  height: 18px;
}

/* Show moon in light, sun in dark */
[data-theme="light"] .theme-icon--sun  { display: none; }
[data-theme="light"] .theme-icon--moon { display: block; }
[data-theme="dark"]  .theme-icon--sun  { display: block; }
[data-theme="dark"]  .theme-icon--moon { display: none; }


/* ===========================================
   CONTROLS BAR
   =========================================== */

.controls-bar {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  position: sticky;
  top: 63px;
  z-index: 90;
  backdrop-filter: blur(12px);
  background: var(--color-header-bg);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.controls-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* Left: Search + Sort */
.controls-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Right: Color controls */
.color-controls {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin-left: auto;
}


/* ===========================================
   SEARCH
   =========================================== */

.search-wrap {
  position: relative;
  min-width: 200px;
  max-width: 280px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.6rem 0.75rem 0.6rem 2.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg-muted);
  transition: var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--color-brand);
  background: var(--color-bg-surface);
  box-shadow: 0 0 0 3px rgba(var(--color-brand-rgb), 0.08);
}

.search-input::placeholder {
  color: var(--color-text-muted);
}


/* ===========================================
   SORT TOGGLE
   =========================================== */

.sort-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-muted);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}

.sort-toggle:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

.sort-toggle.active {
  border-color: var(--color-brand);
  color: var(--color-brand);
  background: var(--color-bg-surface);
}


/* ===========================================
   GRID SIZE BUTTON GROUP
   =========================================== */

.grid-size-group {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.grid-size-btn {
  padding: 0.5rem 0.65rem;
  border: none;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg-muted);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}

.grid-size-btn:last-child {
  border-right: none;
}

.grid-size-btn:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.grid-size-btn.active {
  background: var(--color-bg-surface);
  color: var(--color-brand);
}


/* ===========================================
   COLOR CONTROLS
   =========================================== */

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.control-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.control-label .form-check-input {
  margin: 0;
  width: 0.9rem;
  height: 0.9rem;
}

.control-label .form-check-input:checked {
  background-color: #000000;
  border-color: #000000;
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 34px;
}

.color-picker-wrap.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.hex-input {
  width: 72px;
  padding: 0.3rem 0.5rem;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text);
  outline: none;
  text-transform: lowercase;
}

.hex-input:disabled {
  color: var(--color-text-muted);
}

.color-swatch {
  width: 34px;
  height: 34px;
  border: none;
  border-left: 1px solid var(--color-border);
  cursor: pointer;
  padding: 3px;
  background: var(--color-bg-muted);
  flex-shrink: 0;
}

.color-swatch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.color-swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-swatch::-webkit-color-swatch {
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.stroke-range {
  width: 100px;
  height: 4px;
}

.stroke-range::-webkit-slider-thumb {
  background: var(--color-brand);
}

.stroke-size-group {
  transition: opacity var(--transition);
}


/* ===========================================
   MAIN CONTENT
   =========================================== */

.main-content {
  padding: 1.5rem 0 3rem;
}


/* ===========================================
   STATE CARDS
   =========================================== */

.state-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease forwards;
}

.state-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-preview {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
}

.card-preview svg {
  width: 80px;
  height: 80px;
  transition: var(--transition);
}

.state-card:hover .card-preview svg {
  transform: scale(1.05);
}

.card-info {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.state-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.card-actions {
  display: flex;
  gap: 0.25rem;
}

.card-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: var(--transition);
}

.card-btn:hover {
  background: var(--color-bg-muted);
  color: var(--color-text);
}

.card-btn svg {
  width: 16px;
  height: 16px;
}


/* ===========================================
   NO RESULTS
   =========================================== */

.no-results {
  text-align: center;
  padding: 4rem 0;
  color: var(--color-text-muted);
}

.no-results-icon {
  width: 60px;
  height: 60px;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.no-results p {
  font-size: 1rem;
  font-weight: 500;
}


/* ===========================================
   MODAL
   =========================================== */

.custom-modal {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: var(--color-modal-bg);
}

.custom-modal .modal-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 1.5rem;
  background: var(--color-modal-bg);
}

.custom-modal .modal-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}

.custom-modal .modal-body {
  padding: 1.5rem;
  background: var(--color-modal-bg);
}

.modal-preview {
  background: var(--color-bg-muted);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  margin-bottom: 1.25rem;
  min-height: 260px;
  border: 1px solid var(--color-border);
  transition: background var(--transition);
}

.modal-preview svg {
  /* Dimensions controlled by JS based on selected size */
}


/* ===========================================
   MODAL — SIZE & FORMAT BUTTONS (muted style)
   =========================================== */

.modal-section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.size-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.format-buttons {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

/* Shared base — matches .btn-copy muted style */
.size-btn,
.format-btn {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-muted);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.size-btn:hover,
.format-btn:hover {
  background: var(--color-border);
}

/* Active state — 2px black border */
.size-btn.active,
.format-btn.active {
  border-color: #000000;
  background: var(--color-bg-muted);
  color: var(--color-text);
}

.size-label {
  display: block;
}


/* ===========================================
   MODAL — ACTION BUTTONS
   =========================================== */

.modal-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

.btn-download {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

.btn-download:hover {
  background: #222222;
  border-color: #222222;
}

.btn-copy {
  background: var(--color-bg-muted);
  color: var(--color-text);
}

.btn-copy:hover {
  background: var(--color-border);
}


/* ===========================================
   DARK MODE — BOOTSTRAP OVERRIDES
   =========================================== */

[data-theme="dark"] .modal-content {
  background: var(--color-modal-bg);
  color: var(--color-text);
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
}


/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 768px) {
  .controls-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .controls-left {
    width: 100%;
  }
  .search-wrap {
    flex: 1;
    max-width: 100%;
  }
  .color-controls {
    margin-left: 0;
    gap: 0.75rem;
  }
  .header-title {
    font-size: 1rem;
  }
  .modal-actions {
    flex-direction: column;
  }
}


/* ===========================================
   NOTIFICATION BOX
   =========================================== */

.notification-box {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  padding: 1rem;
}

.notification-box.notification-visible {
  animation: slideUp 0.4s ease forwards;
}

.notification-box.notification-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.notification-box.notification-closing {
  animation: slideDown 0.3s ease forwards;
  pointer-events: none;
}

.notification-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  transition: var(--transition);
}

.notification-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #000000;
}

.notification-inner {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.notification-image {
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
  padding-right: 1rem;
}

.notification-text {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #000000;
  margin: 0 0 0.6rem;
}

.notification-btn {
  display: inline-block;
  font-size: .8rem;
  font-weight: 600;
  color: #ffffff;
  background: #000000;
  padding: .8rem 1.25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
}

.notification-btn:hover {
  background: #222222;
  color: #ffffff;
}

@media (max-width: 480px) {
  .notification-box {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}


/* ===========================================
   ANIMATIONS
   =========================================== */

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

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

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