/* ============================================
   NoAds Theme CSS - Standalone Version
   ============================================
   This file provides CSS variables and classes for all NoAds React components.
   Theme colors can be overridden via config.js if needed.
*/

/* CSS Variables - Default Values */
:root {
  --noads-brand: #2f3a2f;
  --noads-brand-light: #4a5a4a;
  --noads-brand-dark: #1a231a;
  --noads-ink: #222;
  --noads-mute: #6b7280;
  --noads-brd: #ddd;
  --noads-bg: #fff;
  --noads-bg-alt: #f9fafb;
  --noads-error: #dc2626;
  --noads-error-light: #fef2f2;
  --noads-error-dark: #991b1b;
  --noads-success: #10b981;
  --noads-success-light: #d1fae5;
  --noads-success-dark: #065f46;
  --noads-warning: #f59e0b;
  --noads-warning-light: #fef3c7;
  --noads-warning-dark: #92400e;
  
  /* Spacing */
  --noads-pad: 12px;
  --noads-pad-sm: 8px;
  --noads-pad-md: 12px;
  --noads-pad-lg: 16px;
  --noads-pad-xl: 24px;
  
  /* Border Radius */
  --noads-radius: 10px;
  --noads-radius-sm: 6px;
  --noads-radius-md: 8px;
  --noads-radius-lg: 12px;
  
  /* Typography */
  --noads-font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --noads-font-size: 14px;
  --noads-font-size-sm: 12px;
  --noads-font-size-lg: 16px;
  --noads-font-size-xl: 20px;
  --noads-font-size-2xl: 24px;
}

/* Base Container */
.noads-container {
  font-family: var(--noads-font-family);
  color: var(--noads-ink);
  font-size: var(--noads-font-size);
  line-height: 1.6;
}

/* Typography */
.noads-heading {
  margin: 0;
  font-weight: 600;
  color: var(--noads-brand);
  line-height: 1.2;
}

.noads-heading--h1 {
  font-size: var(--noads-font-size-2xl);
  font-weight: 700;
  margin-bottom: var(--noads-pad-lg);
}

.noads-heading--h2 {
  font-size: var(--noads-font-size-xl);
  margin-bottom: var(--noads-pad-lg);
}

.noads-heading--h3 {
  font-size: var(--noads-font-size-lg);
  margin-bottom: var(--noads-pad-md);
}

.noads-text {
  color: var(--noads-ink);
  font-size: var(--noads-font-size);
}

.noads-text--muted {
  color: var(--noads-mute);
  font-size: var(--noads-font-size);
}

.noads-text--sm {
  font-size: var(--noads-font-size-sm);
}

.noads-text--error {
  color: var(--noads-error);
}

.noads-text--success {
  color: var(--noads-success-dark);
}

/* Buttons */
.noads-btn {
  padding: 10px 20px;
  border-radius: var(--noads-radius-sm);
  font-size: var(--noads-font-size);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 44px;
  min-width: 44px;
}

.noads-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.noads-btn--primary {
  background: var(--noads-brand);
  color: #fff;
  border: none;
}

.noads-btn--primary:hover:not(:disabled) {
  background: var(--noads-brand-dark);
  transform: translateY(-1px);
}

.noads-btn--secondary {
  background: #fff;
  color: var(--noads-ink);
  border: 1px solid var(--noads-brd);
}

.noads-btn--secondary:hover:not(:disabled) {
  background: var(--noads-bg-alt);
  border-color: var(--noads-brand);
}

.noads-btn--success {
  background: var(--noads-success);
  color: #fff;
  border: none;
}

.noads-btn--success:hover:not(:disabled) {
  background: var(--noads-success-dark);
}

.noads-btn--disabled {
  background: var(--noads-mute);
  color: #fff;
  border: 1px solid var(--noads-mute);
  cursor: not-allowed;
  opacity: 0.6;
}

.noads-btn--sm {
  padding: 6px 12px;
  font-size: var(--noads-font-size-sm);
  min-height: 44px;
  min-width: 44px;
}

.noads-btn--lg {
  padding: 12px 24px;
  font-size: var(--noads-font-size-lg);
}

/* Box/Container */
.noads-box {
  border: 1px solid var(--noads-brd);
  padding: var(--noads-pad);
  border-radius: var(--noads-radius);
  background: var(--noads-bg);
}

.noads-box--padded {
  padding: var(--noads-pad-lg);
}

.noads-box--spaced {
  margin-bottom: var(--noads-pad-lg);
}

.noads-box--spaced-xl {
  margin-bottom: var(--noads-pad-xl);
}

/* Sections */
.noads-section {
  margin-bottom: var(--noads-pad-xl);
}

.noads-section--spaced {
  margin-bottom: var(--noads-pad-lg);
}

/* Form Elements */
.noads-field {
  margin-bottom: var(--noads-pad-lg);
}

.noads-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--noads-font-size);
  font-weight: 500;
  color: var(--noads-ink);
}

.noads-label--required::after {
  content: '*';
  color: var(--noads-error);
  margin-left: 4px;
}

.noads-input,
.noads-textarea,
.noads-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--noads-brd);
  border-radius: var(--noads-radius-sm);
  font-size: 16px; /* Prevents iOS zoom on focus */
  font-family: inherit;
  background: var(--noads-bg);
  color: var(--noads-ink);
  transition: border-color 0.2s ease;
  min-height: 44px;
}

.noads-input:focus,
.noads-textarea:focus,
.noads-select:focus {
  outline: none;
  border-color: var(--noads-brand);
  box-shadow: 0 0 0 3px rgba(47, 58, 47, 0.1);
}
.noads-input:focus-visible,
.noads-textarea:focus-visible,
.noads-select:focus-visible {
  outline: 3px solid var(--noads-brand);
  outline-offset: 2px;
}

.noads-input--error,
.noads-textarea--error,
.noads-select--error {
  border-color: var(--noads-error);
}

.noads-input--readonly {
  background: var(--noads-bg-alt);
}

.noads-textarea {
  resize: vertical;
  min-height: 80px;
}

.noads-error-message {
  margin-top: 4px;
  font-size: var(--noads-font-size-sm);
  color: var(--noads-error);
}

/* Checkbox */
.noads-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--noads-font-size-sm);
  color: var(--noads-mute);
}

.noads-checkbox input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--noads-brand);
}

/* Alert/Message Boxes */
.noads-alert {
  padding: var(--noads-pad-lg);
  border-radius: var(--noads-radius);
  border: 1px solid;
  margin-top: var(--noads-pad-xl);
}

.noads-alert--success {
  background: var(--noads-success-light);
  border-color: var(--noads-success);
  color: var(--noads-success-dark);
}

.noads-alert--error {
  background: var(--noads-error-light);
  border-color: var(--noads-error);
  color: var(--noads-error-dark);
}

.noads-alert--warning {
  background: var(--noads-warning-light);
  border-color: var(--noads-warning);
  color: var(--noads-warning-dark);
}

/* Flex Utilities */
.noads-flex {
  display: flex;
}

.noads-flex--between {
  justify-content: space-between;
}

.noads-flex--center {
  align-items: center;
}

.noads-flex--gap {
  gap: var(--noads-pad-md);
}

.noads-flex--gap-sm {
  gap: var(--noads-pad-sm);
}

.noads-flex--wrap {
  flex-wrap: wrap;
}

/* Step Indicator */
.noads-step-indicator {
  display: flex;
  align-items: center;
  gap: var(--noads-pad-sm);
  margin-bottom: var(--noads-pad-lg);
}

.noads-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--noads-font-size-sm);
  font-weight: 500;
  border: 2px solid;
}

.noads-step--current {
  background: var(--noads-brand);
  color: #fff;
  border-color: var(--noads-brand);
}

.noads-step--completed {
  background: var(--noads-success);
  color: #fff;
  border-color: var(--noads-success);
}

.noads-step--pending {
  background: #e5e7eb;
  color: var(--noads-mute);
  border-color: #e5e7eb;
}

.noads-step-label {
  font-size: var(--noads-font-size-sm);
  color: var(--noads-mute);
}

/* Navigation Buttons Container */
.noads-nav-buttons {
  display: flex;
  gap: var(--noads-pad-md);
  justify-content: space-between;
}

.noads-nav-buttons--right {
  justify-content: flex-end;
}

/* List Items */
.noads-list-item {
  padding: var(--noads-pad-md);
  border-bottom: 1px solid var(--noads-brd);
}

.noads-list-item:last-child {
  border-bottom: none;
}

/* Badge/Pill */
.noads-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--noads-radius-sm);
  font-size: var(--noads-font-size-sm);
  font-weight: 500;
}

.noads-badge--primary {
  background: var(--noads-brand);
  color: #fff;
}

.noads-badge--success {
  background: var(--noads-success);
  color: #fff;
}

.noads-badge--error {
  background: var(--noads-error);
  color: #fff;
}

/* Spacing Utilities */
.noads-mb-sm {
  margin-bottom: var(--noads-pad-sm);
}

.noads-mb-md {
  margin-bottom: var(--noads-pad-md);
}

.noads-mb-lg {
  margin-bottom: var(--noads-pad-lg);
}

.noads-mb-xl {
  margin-bottom: var(--noads-pad-xl);
}

.noads-mt-sm {
  margin-top: var(--noads-pad-sm);
}

.noads-mt-md {
  margin-top: var(--noads-pad-md);
}

.noads-mt-lg {
  margin-top: var(--noads-pad-lg);
}

.noads-mt-xl {
  margin-top: var(--noads-pad-xl);
}

/* Loading State */
.noads-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
  .noads-nav-buttons {
    flex-direction: column;
  }
  
  .noads-btn {
    width: 100%;
    min-height: 44px;
  }
}

/* Safe area utilities */
.noads-safe-top {
  padding-top: max(var(--noads-pad-md), env(safe-area-inset-top));
}

.noads-safe-bottom {
  padding-bottom: max(var(--noads-pad-md), env(safe-area-inset-bottom));
}

.noads-safe-left {
  padding-left: max(var(--noads-pad-md), env(safe-area-inset-left));
}

.noads-safe-right {
  padding-right: max(var(--noads-pad-md), env(safe-area-inset-right));
}

/* ============================================
   Page Layout - Limit width on large screens
   ============================================ */
body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navigation should span full width */
body > #noads-navigation {
  position: relative;
  width: 100vw;
  max-width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
  /* Smooth transitions to prevent flash */
  transition: opacity 0.15s ease-in-out;
  opacity: 1;
}

/* Hide navigation during page transitions to prevent flash */
body.loading > #noads-navigation {
  opacity: 0;
}

/* Ensure navigation renders quickly */
body > #noads-navigation nav {
  transition: opacity 0.1s ease-in-out;
  opacity: 1;
}

/* On smaller screens, reduce padding */
@media (max-width: 768px) {
  body {
    padding: 0 15px;
  }
  
  body > #noads-navigation {
    padding-left: 15px;
    padding-right: 15px;
  }
}

