/* ==========================================
   BENEFIQ -- BENEFITS PAGE
   Anchor visualization + per-card utilization
   ========================================== */

@layer pages {

  /* ==========================================
     ANCHOR GRAPHIC -- Semi-circle gauge
     Editorial centerpiece -- no card bg, generous
     whitespace, stark annual-report aesthetic
     ========================================== */
  .benefits-anchor {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-5) var(--space-5) var(--space-6);
    margin-bottom: var(--space-6);
    background: var(--color-bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
  }

  /* Semi-circle gauge container */
  .benefits-gauge {
    position: relative;
    width: 400px;
    max-width: 100%;
    margin-bottom: var(--space-6);
  }

  .benefits-gauge-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .benefits-gauge-bg {
    opacity: 0.7;
  }

  .benefits-gauge-fill {
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Center text overlay -- big confident number */
  .benefits-gauge-center {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .benefits-gauge-percent {
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 3.5rem;
    color: var(--color-text);
    line-height: 1;
    letter-spacing: -0.03em;
  }

  .benefits-gauge-label {
    font-size: 0.65rem;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--surface-400);
  }

  /* Stat row beneath the gauge -- understated, subtle */
  .benefits-anchor-stats {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: 0;
  }

  .benefits-anchor-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
  }

  .benefits-anchor-stat-value {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--surface-500);
    line-height: 1;
  }

  .benefits-anchor-stat--success { color: var(--color-success); }
  .benefits-anchor-stat--warning { color: var(--brand-500); }

  .benefits-anchor-stat-label {
    font-size: 0.625rem;
    font-weight: var(--weight-medium);
    color: var(--surface-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .benefits-anchor-stat-divider {
    width: 1px;
    height: 24px;
    background: var(--surface-200);
    opacity: 0.6;
  }

  /* Responsive gauge sizing */
  @media (max-width: 480px) {
    .benefits-anchor {
      padding: var(--space-4) var(--space-3) var(--space-5);
    }
    .benefits-gauge {
      width: 300px;
    }
    .benefits-gauge-percent {
      font-size: 2.5rem;
    }
    .benefits-anchor-stats {
      gap: var(--space-5);
    }
    .benefits-anchor-stat-value {
      font-size: var(--text-sm);
    }
  }

  /* ==========================================
     BENEFIT ACCORDION
     ========================================== */
  .benefits-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .benefit-accordion {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    border: none;
    overflow: hidden;
    transition: box-shadow var(--transition-base);
  }

  .benefit-accordion:hover {
    box-shadow: var(--shadow-card-hover);
  }

  /* Accordion Header */
  .benefit-accordion-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    cursor: pointer;
    transition: background var(--transition-base);
  }

  .benefit-accordion-header:hover {
    background: rgba(0, 0, 0, 0.02);
  }

  .benefit-card-swatch {
    width: 64px;
    height: 40px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .benefit-card-info {
    flex: 1;
    min-width: 0;
  }

  .benefit-card-name {
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    color: var(--color-text);
    margin-bottom: var(--space-1);
  }

  .benefit-card-meta {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-2);
  }

  /* Per-card utilization bar in accordion header */
  .benefit-accordion-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  .benefit-accordion-bar .progress-bar--dashboard {
    flex: 1;
    min-width: 80px;
    max-width: 200px;
  }

  .benefit-accordion-bar-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 32px;
    text-align: right;
  }

  /* Chevron */
  .benefit-chevron {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    transition: transform var(--transition-base);
    flex-shrink: 0;
  }

  .benefit-accordion.expanded .benefit-chevron {
    transform: rotate(180deg);
  }

  /* Accordion Body */
  .benefit-accordion-body {
    display: none;
    padding: 0 var(--space-5) var(--space-5);
  }

  .benefit-accordion.expanded .benefit-accordion-body {
    display: block;
    animation: slide-up 0.2s ease;
  }

  /* ==========================================
     PERK LIST
     ========================================== */
  .perk-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .perk-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-sunken);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
  }

  .perk-item.completed {
    background: var(--success-light);
  }

  .perk-item .perk-info {
    flex: 1;
    min-width: 0;
  }

  /* Perk name row with status badge */
  .perk-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
    flex-wrap: wrap;
  }

  /* Perk Checkbox */
  .perk-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-strong);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-base);
    margin-top: 2px;
  }

  .perk-checkbox:hover {
    border-color: var(--success);
  }

  .perk-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: var(--text-inverse);
  }

  .perk-checkbox svg {
    width: 14px;
    height: 14px;
    opacity: 0;
    transition: opacity var(--transition-base);
  }

  .perk-checkbox.checked svg {
    opacity: 1;
  }

  /* Perk Info */
  .perk-info {
    flex: 1;
    min-width: 0;
  }

  .perk-name {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
  }

  .perk-description {
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-2);
  }

  /* Rotating Category Info -- single-color bg (no orange-green gradient) */
  .rotating-category-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--purple-100);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    font-size: var(--text-xs);
  }

  .rotating-label {
    font-weight: var(--weight-semibold);
    color: var(--purple-600);
  }

  .rotating-categories {
    color: var(--color-text);
    font-weight: var(--weight-medium);
  }

  /* Rotating toggle style */
  .period-toggle.rotating .period-toggle-box {
    border-color: var(--primary);
  }

  .period-toggle.rotating input:checked + .period-toggle-box {
    background: var(--primary);
    border-color: var(--primary);
  }

  .perk-single-check {
    margin-top: var(--space-3);
  }

  /* Perk Tags */
  .perk-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .perk-tag {
    display: inline-flex;
    padding: var(--space-1) var(--space-2);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
  }

  .perk-tag.value {
    background: var(--accent-blue-100);
    color: var(--accent-blue-600);
  }

  .perk-tag.frequency {
    background: var(--color-warning-light);
    color: var(--color-warning);
  }

  .perk-tag-activation,
  .perk-tag-activated {
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
  }

  .perk-tag-activation {
    background: var(--bg-elevated);
    color: var(--text-secondary);
  }

  .perk-tag-activation:hover {
    background: var(--surface-200);
    color: var(--text);
  }

  .perk-tag-activated {
    background: var(--success-light);
    color: var(--success);
  }

  .perk-tag-activated:hover {
    opacity: 0.7;
  }

  /* Perk Value */
  .perk-value {
    text-align: right;
    flex-shrink: 0;
  }

  .perk-value-used {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--success);
  }

  .perk-value-total {
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  /* Mini progress bar per perk */
  .perk-mini-bar {
    width: 100%;
    min-width: 48px;
  }

  /* ==========================================
     PERIOD TOGGLES
     ========================================== */
  .perk-periods {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
  }

  .period-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
  }

  .period-toggle:hover {
    background: var(--primary-light);
  }

  .period-toggle input {
    display: none;
  }

  .period-toggle-box {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-strong);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
  }

  .period-toggle-box svg {
    opacity: 0;
    transition: opacity var(--transition-base);
  }

  .period-toggle input:checked + .period-toggle-box {
    background: var(--success);
    border-color: var(--success);
    color: white;
  }

  .period-toggle input:checked + .period-toggle-box svg {
    opacity: 1;
  }

  .period-toggle-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
  }

  .period-toggle input:checked ~ .period-toggle-label {
    color: var(--success);
  }

  /* Future/disabled periods */
  .period-toggle.future {
    opacity: 0.4;
    cursor: not-allowed;
  }

  .period-toggle.future .period-toggle-box {
    background: var(--bg-sunken);
    border-color: var(--border);
  }

  .period-toggle.future .period-toggle-label {
    color: var(--text-muted);
  }

  .period-toggle.future::after {
    content: '\1F512';
    font-size: 10px;
    margin-left: 2px;
  }

  /* ==========================================
     EMPTY STATE
     ========================================== */
  .benefits-empty {
    text-align: center;
    padding: var(--space-12) var(--space-5);
    margin-top: var(--space-6);
    background: var(--bg-elevated);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
  }

  .benefits-empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.3;
  }

  .benefits-empty h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
  }

  .benefits-empty p {
    color: var(--text-muted);
    margin-bottom: var(--space-5);
  }

  /* Touch target compliance (44px minimum) */
  @media (pointer: coarse) {
    .benefit-action-btn {
      min-height: 44px;
      min-width: 44px;
    }
  }

}
