/* ============================================
   USMC Tools - Pros/Cons Generator
   OSMEAC Color Scheme with Full Theme Support
   ============================================ */

/* ===========================================
   CSS Variables - Dark Mode (Default)
   =========================================== */
:root {
  /* OSMEAC Color Scheme - Dark Mode Default */
  --bg-body: #1A1A1A;
  --bg-card: #2D2D2D;
  --bg-input: #3A3A3A;
  --border-input: #6A6A6A;
  --text-primary: #E5E5E5;
  --text-secondary: #CCCCCC;
  --text-muted: #AAAAAA;
  --accent-red: #DC4444;
  --accent-yellow: #EAB308;
  --btn-primary: #C41E3A;
  --header-gradient-start: #5C1A1A;
  --header-gradient-end: #6C2A2A;
  --tab-active-bg: #DC4444;
  --tab-inactive-bg: #3A3A3A;

  /* Legacy variable mappings for compatibility */
  --primary: #DC4444;
  --primary-dark: #B93333;
  --primary-light: #E55555;
  --secondary: #3A3A3A;
  --secondary-dark: #2D2D2D;
  --secondary-light: #4A4A4A;
  --gold: #EAB308;
  --gold-dark: #CA9A07;
  --white: #FFFFFF;
  --black: #000000;

  /* Semantic Colors */
  --success: #28A745;
  --success-light: rgba(40, 167, 69, 0.2);
  --warning: #EAB308;
  --warning-light: rgba(234, 179, 8, 0.2);
  --error: #DC4444;
  --error-light: rgba(220, 68, 68, 0.2);
  --info: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.2);

  /* Background & Surface */
  --bg-primary: var(--bg-body);
  --bg-secondary: var(--bg-card);
  --bg-tertiary: var(--bg-input);
  --surface: var(--bg-card);
  --surface-hover: var(--bg-input);

  /* Text */
  --text-tertiary: var(--text-muted);
  --text-inverse: #1A1A1A;

  /* Borders */
  --border-light: #3A3A3A;
  --border-medium: var(--border-input);
  --border-dark: #8A8A8A;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);

  /* Font Families */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Spacing */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;
}

/* ===========================================
   Light Mode
   =========================================== */
[data-theme="light"] {
  --bg-body: #F5F5F0;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --border-input: #DEE2E6;
  --text-primary: #343A40;
  --text-secondary: #495057;
  --text-muted: #6C757D;
  --accent-red: #8B0000;
  --accent-yellow: #8B0000;
  --tab-active-bg: #8B0000;
  --tab-inactive-bg: #F8F9FA;
  --header-gradient-start: #8B0000;
  --header-gradient-end: #6B0000;

  /* Legacy mappings */
  --primary: #8B0000;
  --primary-dark: #6B0000;
  --primary-light: #A52A2A;
  --gold: #8B0000;
  --gold-dark: #6B0000;

  /* Semantic Colors */
  --success: #28A745;
  --success-light: #D4EDDA;
  --warning: #FFC107;
  --warning-light: #FFF3CD;
  --error: #DC3545;
  --error-light: #F8D7DA;
  --info: #17A2B8;
  --info-light: #D1ECF1;

  /* Background & Surface */
  --bg-primary: var(--bg-body);
  --bg-secondary: var(--bg-card);
  --bg-tertiary: #F8F9FA;
  --surface: var(--bg-card);
  --surface-hover: #F8F9FA;

  /* Text */
  --text-tertiary: var(--text-muted);
  --text-inverse: #FFFFFF;

  /* Borders */
  --border-light: #E9ECEF;
  --border-medium: var(--border-input);
  --border-dark: #ADB5BD;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ===========================================
   Night Mode (Tactical - Red on Black)
   =========================================== */
[data-theme="night"] {
  --bg-body: #0A0A0A;
  --bg-card: #1A1A1A;
  --bg-input: #2A2A2A;
  --border-input: #4A0000;
  --text-primary: #DC4444;
  --text-secondary: #DC4444;
  --text-muted: #AA3333;
  --accent-red: #DC4444;
  --accent-yellow: #DC4444;
  --btn-primary: #DC4444;
  --header-gradient-start: #2A0A0A;
  --header-gradient-end: #3A1A1A;
  --tab-active-bg: #DC4444;
  --tab-inactive-bg: #2A2A2A;

  /* Legacy mappings */
  --primary: #DC4444;
  --primary-dark: #AA3333;
  --primary-light: #EE5555;
  --secondary: #DC4444;
  --gold: #DC4444;
  --gold-dark: #AA3333;

  /* Semantic Colors - All red for night vision */
  --success: #DC4444;
  --success-light: rgba(220, 68, 68, 0.2);
  --warning: #DC4444;
  --warning-light: rgba(220, 68, 68, 0.2);
  --error: #DC4444;
  --error-light: rgba(220, 68, 68, 0.2);
  --info: #DC4444;
  --info-light: rgba(220, 68, 68, 0.2);

  /* Background & Surface */
  --bg-primary: var(--bg-body);
  --bg-secondary: var(--bg-card);
  --bg-tertiary: var(--bg-input);
  --surface: var(--bg-card);
  --surface-hover: var(--bg-input);

  /* Text */
  --text-tertiary: var(--text-muted);
  --text-inverse: #0A0A0A;

  /* Borders */
  --border-light: #3A0000;
  --border-medium: var(--border-input);
  --border-dark: #6A0000;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(220, 68, 68, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(220, 68, 68, 0.15), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(220, 68, 68, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
}

/* Focus States - Accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background-color: var(--primary);
  color: var(--white);
}

/* ===========================================
   Skip Link (Accessibility)
   =========================================== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: var(--white);
  padding: var(--space-2) var(--space-4);
  z-index: 100;
  transition: top 0.2s;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* ===========================================
   Container
   =========================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 640px) {
  .container {
    padding: 0 var(--space-6);
  }
}

/* ===========================================
   Header
   =========================================== */
.header {
  background: linear-gradient(135deg, #8B1538, #3d0714);
  color: #FFFFFF;
  padding: var(--space-6) 0;
  box-shadow: var(--shadow-md);
}

/* Scarlet accent line below header */
.header-accent {
  height: 4px;
  background: #C41E3A;
}

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

.header__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header__subtitle {
  font-size: var(--text-sm);
  opacity: 0.9;
}

@media (min-width: 640px) {
  .header__title {
    font-size: var(--text-3xl);
  }
}

/* Theme toggle button - circle with icon */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.theme-toggle .icon {
  width: 20px;
  height: 20px;
}

/* ===========================================
   Main Content
   =========================================== */
.main-content {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

/* ===========================================
   Cards
   =========================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card--elevated {
  box-shadow: var(--shadow-md);
}

/* Section card - full border, no left accent */
.card--section {
  /* Uses base card styling - full subtle border */
}

/* Card theme adjustments now handled by CSS variables */

.card__header {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

/* Section title style - ALL CAPS */
.card__title--section {
  text-transform: uppercase;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}

.card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ===========================================
   Tagline / Subheader
   =========================================== */
.tagline {
  background: var(--bg-secondary);
  padding: var(--space-3) 0;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.tagline__text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.tagline__link {
  color: var(--primary);
  text-decoration: none;
  font-weight: var(--font-medium);
}

.tagline__link:hover {
  text-decoration: underline;
}

/* ===========================================
   Buttons
   =========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

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

/* Primary Button */
.btn--primary {
  background: var(--primary);
  color: var(--white);
}

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

/* Secondary Button */
.btn--secondary {
  background: var(--secondary);
  color: var(--white);
}

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

/* Outline Button */
.btn--outline {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
}

.btn--outline:hover:not(:disabled) {
  background: var(--bg-secondary);
}

/* Dashed Outline Button (for "Add Phrase" style) */
.btn--dashed {
  background: transparent;
  border: 1px dashed var(--border-medium);
  color: var(--text-secondary);
}

.btn--dashed:hover:not(:disabled) {
  border-color: var(--accent-red);
  color: var(--text-primary);
  background: transparent;
}

/* Outline Primary Button (outlined with red/primary text) */
.btn--outline-primary {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--accent-red);
}

.btn--outline-primary:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: var(--accent-red);
}

/* Ghost Button */
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Success Button */
.btn--success {
  background: var(--success);
  color: var(--white);
}

.btn--success:hover:not(:disabled) {
  background: #059669;
}

/* Danger Button */
.btn--danger {
  background: var(--error);
  color: var(--white);
}

.btn--danger:hover:not(:disabled) {
  background: #DC2626;
}

/* Button Sizes */
.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* Full Width */
.btn--full {
  width: 100%;
}

/* ===========================================
   Form Elements
   =========================================== */
.form-group {
  margin-bottom: var(--space-4);
}

.form-group:last-child {
  margin-bottom: 0;
}

/* Labels */
.label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.label--required::after {
  content: ' *';
  color: var(--error);
}

/* Input Base */
.input {
  width: 100%;
  padding: var(--space-3);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  outline: none;
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(220, 68, 68, 0.2);
}

[data-theme="light"] .input:focus {
  box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

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

.input:disabled {
  background: var(--bg-secondary);
  cursor: not-allowed;
}

/* Input States */
.input--error {
  border-color: var(--error);
}

.input--error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input--success {
  border-color: var(--success);
}

/* Textarea */
.textarea {
  min-height: 120px;
  resize: vertical;
}

/* Select */
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

/* Character Counter */
.char-counter {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.char-counter--warning {
  color: var(--warning);
}

.char-counter--error {
  color: var(--error);
}

/* ===========================================
   Alerts
   =========================================== */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.alert--info {
  background: var(--info-light);
  color: var(--info);
  border: 1px solid var(--info);
}

.alert--success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}

.alert--warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.alert--error {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid var(--error);
}

/* ===========================================
   Modal
   =========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-overlay--active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal__header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-light);
}

.modal__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.modal__body {
  padding: var(--space-6);
}

.modal__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ===========================================
   Quick Phrases
   =========================================== */
.quick-phrases {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}

.quick-phrases__label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  display: block;
  margin-bottom: var(--space-2);
}

.quick-phrases__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.quick-phrase {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: var(--text-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-phrase:hover {
  border-color: var(--accent-red);
  color: var(--text-primary);
}

/* ===========================================
   Phrase List (Modal)
   =========================================== */
.phrase-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 300px;
  overflow-y: auto;
}

.phrase-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease;
}

.phrase-item:hover {
  background: var(--bg-tertiary);
}

.phrase-item input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--primary);
}

.phrase-item label {
  font-size: var(--text-sm);
  cursor: pointer;
  flex: 1;
}

/* ===========================================
   Draft List
   =========================================== */
.draft-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 300px;
  overflow-y: auto;
}

.draft-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease;
}

.draft-item:hover {
  background: var(--bg-tertiary);
}

.draft-item__info {
  flex: 1;
}

.draft-item__name {
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

.draft-item__date {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.draft-item__actions {
  display: flex;
  gap: var(--space-2);
}

/* ===========================================
   Toast
   =========================================== */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: var(--gray-800);
  color: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.toast--visible {
  opacity: 1;
  visibility: visible;
}

/* ===========================================
   Template Buttons
   =========================================== */
.template-buttons {
  /* Spacing handled by card__header margin-bottom */
}

/* ===========================================
   Action Bar
   =========================================== */
.action-bar {
  position: sticky;
  bottom: var(--space-4);
  z-index: 10;
}

/* Mobile: Stack action buttons vertically */
@media (max-width: 600px) {
  .action-bar .flex.justify-between {
    flex-direction: column;
    gap: var(--space-3);
  }

  .action-bar .flex.justify-between > .flex {
    width: 100%;
    flex-direction: column;
  }

  .action-bar .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===========================================
   Footer
   =========================================== */
.footer {
  margin-top: var(--space-12);
  padding: var(--space-8) 0;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ===========================================
   Utility Classes
   =========================================== */
/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Spacing */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.p-4 { padding: var(--space-4); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.font-bold { font-weight: var(--font-bold); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }

/* Display */
.hidden { display: none; }
.block { display: block; }

/* Width */
.w-full { width: 100%; }

/* ===========================================
   Icon Utilities
   =========================================== */
.icon {
  flex-shrink: 0;
}

/* ===========================================
   Print Styles
   =========================================== */
@media print {
  body {
    background: white;
    color: black;
    font-size: 12pt;
  }

  .no-print {
    display: none !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .btn {
    display: none;
  }

  a {
    text-decoration: none;
    color: black;
  }

  .action-bar {
    position: static;
  }

  .split-layout {
    display: block;
  }

  .live-preview-pane {
    display: none !important;
  }
}

/* ===========================================
   Action Button Group (OSMEAC/Award Pattern)
   =========================================== */
.action-button-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) 0;
}

/* Primary Preview Button - Coral/Red */
.btn--preview {
  background: var(--accent-red);
  color: #FFFFFF;
  padding: 0.5rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: var(--font-medium);
  border: none;
}

.btn--preview:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn--preview.active {
  background: var(--btn-primary);
}

.btn--preview.active:hover:not(:disabled) {
  background: #218838;
}

/* Secondary Outline Button */
.btn--secondary-outline {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: var(--font-medium);
  border: 1px solid var(--border-input);
}

.btn--secondary-outline:hover:not(:disabled) {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--accent-red);
}

@media (max-width: 640px) {
  .action-button-group {
    flex-direction: column;
    gap: var(--space-2);
  }

  .action-button-group .btn {
    width: 100%;
    max-width: 280px;
  }
}

/* ===========================================
   Layout
   =========================================== */
.split-layout {
  display: block;
}

.editor-panel {
  width: 100%;
}

/* ===========================================
   Export Options
   =========================================== */
.export-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.export-option {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s ease;
}

.export-option:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.export-option__icon {
  flex-shrink: 0;
  color: var(--primary);
}

.export-option__info h4 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.export-option__info p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

/* ===========================================
   Live PDF Preview Pane
   =========================================== */
.live-preview-pane {
  position: fixed;
  top: 0;
  right: -50%;
  width: 50%;
  height: 100vh;
  background: var(--bg-secondary);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.live-preview-pane.show {
  right: 0;
}

.live-preview-pane .preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.preview-header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-format-select {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background 0.2s;
}

.preview-format-select:hover {
  background: rgba(255,255,255,0.25);
}

.preview-format-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
}

.preview-format-select option {
  background: var(--primary);
  color: white;
}

.preview-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.preview-close:hover {
  opacity: 1;
}

.preview-frame {
  flex: 1;
  border: none;
  background: white;
}

.preview-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  z-index: 10;
}

.preview-loading.show {
  display: flex;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* When preview is active, shrink the main container to the left */
.main-content.preview-active {
  max-width: 50%;
  margin-left: 0;
  margin-right: auto;
  padding-right: var(--space-4);
  transition: max-width 0.3s ease, margin 0.3s ease;
}

/* Preview toggle button active state handled by .btn--preview.active */

/* Responsive: fullscreen preview on mobile/tablet */
@media (max-width: 1024px) {
  .live-preview-pane {
    width: 100%;
    right: -100%;
  }

  .live-preview-pane.show {
    right: 0;
  }

  .main-content.preview-active {
    display: none;
  }

  /* Larger close button for mobile touch targets */
  .preview-close {
    font-size: 2rem;
    padding: 4px 12px;
    min-width: 44px;
    min-height: 44px;
  }

  .preview-header {
    padding: 14px 16px;
  }
}

/* Light theme preview adjustments */
[data-theme="light"] .live-preview-pane {
  background: var(--bg-secondary);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}

[data-theme="light"] .live-preview-pane .preview-header {
  background: var(--header-gradient-start);
}

/* Night/tactical theme preview */
[data-theme="night"] .live-preview-pane {
  background: var(--bg-card);
  box-shadow: -4px 0 20px rgba(0,0,0,0.6);
}

[data-theme="night"] .live-preview-pane .preview-header {
  background: var(--header-gradient-start);
}
