/*!
 * WWOF Theme Bridge v1.0
 * Maps old common.css variable names to wwof-bootstrap tokens.
 * This file allows incremental migration — templates using old variable
 * names continue to work while being migrated one-by-one.
 *
 * DELETE THIS FILE once all templates are migrated (Phase 7).
 */

:root {
  /* ── Old brand tokens → new tokens ── */
  --navy:          var(--wwof-dark);
  --navy-dark:     var(--wwof-dark-3);
  --gold:          var(--wwof-gold-light);
  --gold-rich:     var(--wwof-gold);
  --gold-deep:     var(--wwof-gold-dark);
  --seashell:      var(--wwof-warm);
  --gray-11:       var(--wwof-muted);
  --gray-10:       var(--wwof-muted);
  --brand-red:     var(--wwof-danger);
  --brand-amber:   var(--wwof-warning);
  --brand-teal:    var(--wwof-success);

  /* ── Surfaces ── */
  --bg-body:       var(--wwof-bg);
  --bg-card:       var(--wwof-surface);
  --bg-surface:    var(--wwof-surface-2);
  --border:        var(--wwof-border);
  --border-strong: var(--wwof-border);

  /* ── Text ── */
  --text-primary:   var(--wwof-text);
  --text-secondary: var(--wwof-text-2);
  --text-muted:     var(--wwof-muted);

  /* ── Focus / misc ── */
  --focus-ring:     var(--wwof-gold-soft);
  --ease-out:       var(--ease);
  --duration-fast:  0.2s;
  --duration-base:  0.3s;
  --duration-reveal: 0.6s;
}


/* ══════════════════════════════════════════════════════════════
   Old component classes that map to wwof-bootstrap equivalents.
   These keep un-migrated templates working.
   ══════════════════════════════════════════════════════════════ */

/* Container / layout */
.container, .content {
  width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px;
}

/* Old .btn → wwof-btn bridge */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; font-family: var(--font); font-size: var(--fs-sm); font-weight: 600;
  border: 1px solid var(--wwof-border); border-radius: var(--radius-sm);
  background: var(--wwof-surface); color: var(--wwof-text);
  cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
  text-decoration: none; line-height: 1.4;
}
.btn:hover { border-color: var(--wwof-gold); color: var(--wwof-gold); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--wwof-gold); color: #fff; border-color: var(--wwof-gold); }
.btn-primary:hover { background: var(--wwof-gold-hover); border-color: var(--wwof-gold-hover); color: #fff; }
.btn-success { background: var(--wwof-success); color: #fff; border-color: var(--wwof-success); }
.btn-success:hover { background: #256b29; border-color: #256b29; color: #fff; }
.btn-danger { background: var(--wwof-danger); color: #fff; border-color: var(--wwof-danger); }
.btn-danger:hover { background: #9c2a28; border-color: #9c2a28; color: #fff; }
.btn-secondary { background: var(--wwof-dark); color: #fff; border-color: var(--wwof-dark); }
.btn-secondary:hover { background: var(--wwof-dark-2); color: #fff; }

/* Old card classes */
.card {
  background: var(--wwof-surface); border: 1px solid var(--wwof-border);
  border-radius: var(--radius); box-shadow: var(--shadow-xs);
  margin-bottom: var(--sp-4);
}
.card-header {
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--wwof-border-2);
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: var(--fs-sm); font-weight: 600;
}
.card-header h3 { margin: 0; font-size: var(--fs-md); }
.card-header-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; flex-shrink: 0;
  background: var(--wwof-gold);
}
.card-body { padding: var(--sp-3) var(--sp-4) var(--sp-4); }

/* Old form classes */
.form-group { margin-bottom: var(--sp-4); }
.form-group label {
  display: block; font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; color: var(--wwof-muted);
  margin-bottom: var(--sp-1);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 8px 12px; font-family: var(--font); font-size: var(--fs-sm);
  border: 1px solid var(--wwof-border); border-radius: var(--radius-sm);
  background: var(--wwof-surface); color: var(--wwof-text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--wwof-gold); box-shadow: 0 0 0 3px var(--wwof-gold-soft);
}

/* Old alert/message classes */
.alert, .success-message {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius);
  font-size: var(--fs-sm); margin-bottom: var(--sp-4);
}
.alert-success, .success-message {
  background: var(--wwof-success-soft); border-left: 3px solid var(--wwof-success); color: var(--wwof-success);
}
.alert-error, .error-message {
  background: var(--wwof-danger-soft); border-left: 3px solid var(--wwof-danger); color: var(--wwof-danger);
}
.alert-warning {
  background: var(--wwof-warning-soft); border-left: 3px solid var(--wwof-warning); color: #7a5a0a;
}
.alert-info, .info-box {
  background: var(--wwof-info-soft); border-left: 3px solid var(--wwof-info); color: #1a4fc0;
}

/* Old status badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}

/* Old table styling */
table {
  border-collapse: separate; border-spacing: 0; width: 100%;
}
table thead th {
  background: var(--wwof-surface-2); border-bottom: 2px solid var(--wwof-border);
  padding: 10px 14px; font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; color: var(--wwof-muted); text-align: left;
}
table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--wwof-border-2); font-size: var(--fs-sm); }
table tbody tr { transition: background var(--t-fast); }
table tbody tr:hover { background: var(--wwof-gold-soft); }

/* Search bar (used across lookup, cspec, etc.) */
.search-bar {
  display: flex; gap: var(--sp-2); align-items: center;
}
.search-bar input {
  flex: 1; padding: 8px 12px; font-family: var(--font); font-size: var(--fs-sm);
  border: 1px solid var(--wwof-border); border-radius: var(--radius-sm);
  background: var(--wwof-surface); color: var(--wwof-text);
}
.search-bar input:focus {
  outline: none; border-color: var(--wwof-gold); box-shadow: 0 0 0 3px var(--wwof-gold-soft);
}

/* Empty state */
.empty-state {
  text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--wwof-muted);
}

/* Resource placeholder (iframe fallback) */
.resource-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-8); color: var(--wwof-muted); text-align: center;
}
.rp-icon { font-size: 2.5rem; margin-bottom: var(--sp-3); color: var(--wwof-border); }
.rp-title { font-size: var(--fs-md); font-weight: 600; color: var(--wwof-text); margin-bottom: var(--sp-1); }
.rp-message { font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.rp-retry {
  padding: 6px 16px; border: 1px solid var(--wwof-border); border-radius: var(--radius-sm);
  background: var(--wwof-surface); color: var(--wwof-text); cursor: pointer;
  font-size: var(--fs-sm); font-weight: 500;
}
.rp-retry:hover { border-color: var(--wwof-gold); color: var(--wwof-gold); }

/* Image link (used in activity_detail) */
.image-link {
  color: var(--wwof-gold); text-decoration: none; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.image-link:hover { text-decoration: underline; }

/* Loading overlay */
.loading-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
}

/* Credit footer */
.credit-footer {
  text-align: center; padding: var(--sp-4); font-size: var(--fs-xs); color: var(--wwof-muted);
  border-top: 1px solid var(--wwof-border); margin-top: var(--sp-6);
}
.credit-footer img {
  max-width: 180px; height: auto; opacity: 0.4;
}
.credit-footer img:hover { opacity: 0.7; }

/* Skip to content */
.skip-to-content {
  position: absolute; top: -100px; left: 16px; z-index: 10002;
  background: var(--wwof-dark); color: white;
  padding: 12px 24px; border-radius: 0 0 8px 8px;
  font-weight: 600; font-size: 14px; text-decoration: none;
  transition: top 0.2s ease;
}
.skip-to-content:focus { top: 0; outline: 3px solid var(--wwof-gold); outline-offset: 2px; }

/* Scroll-reveal animation (used with IntersectionObserver) */
.card { opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; }
.card.visible { opacity: 1; transform: translateY(0); }

/* Help modal */
.help-modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
  justify-content: center; align-items: center;
}
.help-modal-overlay.active {
  display: flex;
}
.help-modal {
  background: var(--wwof-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); width: 90%; max-width: 560px; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.help-modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--wwof-border);
  display: flex; align-items: center; justify-content: space-between;
}
.help-modal-header h3 { margin: 0; font-size: var(--fs-lg); font-weight: 700; color: var(--wwof-text); }
.help-modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--wwof-muted);
  font-size: 1.4rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.help-modal-close:hover { background: var(--wwof-danger-soft); color: var(--wwof-danger); }
.help-modal-description {
  padding: 12px 20px 0; font-size: var(--fs-sm); color: var(--wwof-muted); margin: 0;
}
#helpItems {
  padding: 12px 20px 20px; overflow-y: auto; flex: 1;
}
.help-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--wwof-border-2);
}
.help-item:last-child { border-bottom: none; }
.help-item i { color: var(--wwof-gold); font-size: 1rem; margin-top: 2px; flex-shrink: 0; }
.help-item-term { font-weight: 600; font-size: var(--fs-sm); color: var(--wwof-text); display: flex; align-items: center; gap: 8px; }
.help-item-definition { font-size: var(--fs-xs); color: var(--wwof-muted); margin-top: 2px; }
.help-item-title { font-weight: 600; font-size: var(--fs-sm); color: var(--wwof-text); }
.help-item-desc { font-size: var(--fs-xs); color: var(--wwof-muted); margin-top: 2px; }

/* FA spinner animation — Bootstrap Icons doesn't include spin */
@keyframes fa-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.fa-spin, .bi-spin { animation: fa-spin 1s linear infinite; display: inline-block; }
