/* =============================================================
   Reef PAR Lighting Estimator — public (scoped under .reef-par-app)
   Atmospheric reef palette: actinic blues, coral accents, deep water.
   Spacing scale: 4 / 8 / 12 / 16 / 20 / 24 / 32
   ============================================================= */

.reef-par-app {
    --reef-par-accent: #5e9bff;       /* actinic blue */
    --reef-par-actinic: #8bbcff;      /* lighter actinic glow */
    --reef-par-coral: #ff7e62;        /* coral fluorescence pop */
    --reef-par-bg: #04101a;           /* abyssal */
    --reef-par-panel: #081a2a;        /* deep water */
    --reef-par-panel-2: #0c2336;      /* mid water */
    --reef-par-text: #e3edf7;         /* cool surface light */
    --reef-par-text-2: #cdd6e6;       /* secondary readable text */
    --reef-par-muted: #7a98b8;        /* cool steel-blue */
    --reef-par-border: #14304a;       /* deep teal border */
    --reef-par-border-strong: #1d4368;/* hover/focus border */
    --reef-par-good: #3fdca0;
    --reef-par-warn: #f4a83a;
    --reef-par-error: #ff6b6b;
    --reef-par-info: #6fc7ff;
    --reef-par-focus-ring: rgba(94, 155, 255, 0.45);

    --reef-par-radius: 12px;
    --reef-par-radius-sm: 8px;
    --reef-par-radius-xs: 6px;

    box-sizing: border-box;
    width: 100%;
    color: var(--reef-par-text);
    background:
        radial-gradient(ellipse at 50% -10%, rgba(94, 155, 255, 0.10), transparent 55%),
        linear-gradient(180deg, #07182a 0%, #04101a 60%, #020a14 100%);
    border: 1px solid var(--reef-par-border);
    border-radius: 14px;
    padding: 20px 24px 16px;
    font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.reef-par-app *,
.reef-par-app *::before,
.reef-par-app *::after {
    box-sizing: border-box;
}
.reef-par-app input,
.reef-par-app select,
.reef-par-app button {
    font: inherit;
    color: inherit;
}

/* ---------- Header ---------- */
.reef-par-app__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.reef-par-app__title,
.reef-par-app h2.reef-par-app__title {
    margin: 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: -0.01em !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.reef-par-app__title-accent {
    color: var(--reef-par-actinic) !important;
    font-weight: 700 !important;
}
.reef-par-app__actions {
    display: flex;
    gap: 8px;
}

/* ---------- Buttons ---------- */
.reef-par-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--reef-par-accent);
    color: var(--reef-par-bg);
    border: 1px solid transparent;
    border-radius: var(--reef-par-radius-sm);
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background 140ms ease, transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.reef-par-btn:hover { background: var(--reef-par-actinic); }
.reef-par-btn:active { transform: translateY(1px); }
.reef-par-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--reef-par-focus-ring);
}
.reef-par-btn[disabled],
.reef-par-btn[aria-disabled="true"] {
    background: rgba(94, 155, 255, 0.18);
    color: var(--reef-par-muted);
    cursor: not-allowed;
    transform: none;
}
.reef-par-btn--ghost {
    background: transparent;
    border-color: var(--reef-par-border);
    color: var(--reef-par-text);
}
.reef-par-btn--ghost:hover {
    background: rgba(94, 155, 255, 0.08);
    border-color: rgba(94, 155, 255, 0.45);
}

/* ---------- Layout ---------- */
.reef-par-app__layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 16px;
}
@media (max-width: 1024px) {
    .reef-par-app__layout { grid-template-columns: 1fr; }
}

.reef-par-col {
    background: var(--reef-par-panel);
    border: 1px solid var(--reef-par-border);
    border-radius: var(--reef-par-radius);
    padding: 16px;
    min-height: 260px;
}
.reef-par-col__title,
.reef-par-app h3.reef-par-col__title {
    margin: 0 0 14px !important;
    padding: 0 0 8px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: 0.01em !important;
    color: #ffffff !important;
    border-bottom: 1px solid var(--reef-par-border);
    text-transform: none;
}

/* ---------- Forms ---------- */
.reef-par-section {
    background: transparent;
    border: 0;
    padding: 0;
    margin-bottom: 16px;
}
.reef-par-section + .reef-par-section { margin-top: 4px; }
.reef-par-section h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--reef-par-muted);
}
.reef-par-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.reef-par-field { display: flex; flex-direction: column; gap: 4px; }
.reef-par-field--full { grid-column: 1 / -1; }
.reef-par-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--reef-par-muted);
}
.reef-par-input,
.reef-par-select {
    background: rgba(4, 16, 26, 0.6);
    color: var(--reef-par-text);
    border: 1px solid var(--reef-par-border);
    border-radius: var(--reef-par-radius-xs);
    padding: 8px 10px;
    outline: none;
    width: 100%;
    transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.reef-par-input:hover,
.reef-par-select:hover {
    border-color: var(--reef-par-border-strong);
}
.reef-par-input:focus,
.reef-par-input:focus-visible,
.reef-par-select:focus,
.reef-par-select:focus-visible {
    border-color: var(--reef-par-accent);
    background: rgba(4, 16, 26, 0.85);
    box-shadow: 0 0 0 3px var(--reef-par-focus-ring);
}
.reef-par-input[type="number"] { font-variant-numeric: tabular-nums; }

/* ---------- Tank mode toggle ---------- */
.reef-par-tank-mode {
    display: flex;
    border: 1px solid var(--reef-par-border);
    border-radius: var(--reef-par-radius-sm);
    overflow: hidden;
    margin-bottom: 12px;
    background: rgba(4, 16, 26, 0.4);
}
.reef-par-tank-mode button {
    flex: 1;
    background: transparent;
    border: 0;
    color: var(--reef-par-muted);
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 500;
    font-size: 12px;
    transition: background 140ms ease, color 140ms ease;
}
.reef-par-tank-mode button:hover {
    color: var(--reef-par-text);
    background: rgba(94, 155, 255, 0.06);
}
.reef-par-tank-mode button.is-active {
    background: var(--reef-par-accent);
    color: var(--reef-par-bg);
    font-weight: 600;
}
.reef-par-tank-mode button:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--reef-par-focus-ring);
}

/* ---------- Advanced disclosure ---------- */
.reef-par-advanced {
    margin-top: 12px;
    border-top: 1px solid var(--reef-par-border);
    padding-top: 12px;
}
.reef-par-advanced-toggle {
    background: transparent;
    border: 0;
    color: var(--reef-par-muted);
    cursor: pointer;
    padding: 4px 4px 4px 0;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 4px;
    transition: color 140ms ease, box-shadow 140ms ease;
}
.reef-par-advanced-toggle:hover { color: var(--reef-par-text); }
.reef-par-advanced-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--reef-par-focus-ring);
    color: var(--reef-par-text);
}
.reef-par-advanced-toggle__caret {
    display: inline-block;
    transition: transform 160ms ease;
    color: var(--reef-par-accent);
}
.reef-par-advanced-toggle[aria-expanded="true"] .reef-par-advanced-toggle__caret {
    transform: rotate(90deg);
}
.reef-par-advanced-body {
    margin-top: 12px;
}
.reef-par-advanced-body[hidden] { display: none; }

/* ---------- HEI lens ---------- */
.reef-par-hei {
    background: rgba(94, 155, 255, 0.06);
    border: 1px solid rgba(94, 155, 255, 0.22);
    border-radius: var(--reef-par-radius-sm);
    padding: 8px 12px;
}
.reef-par-hei__label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: var(--reef-par-text) !important;
    cursor: pointer;
}
.reef-par-hei__label input[type="checkbox"] {
    accent-color: var(--reef-par-accent);
    width: 14px;
    height: 14px;
}
.reef-par-hei__hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--reef-par-muted);
    line-height: 1.4;
}

.reef-par-modified-flag {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--reef-par-coral);
}
.reef-par-modified-flag::before {
    content: "● ";
    opacity: 0.7;
}

/* ---------- Heatmap ---------- */
.reef-par-heatmap-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}
.reef-par-heatmap {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    background: #02080f;
    border: 1px solid var(--reef-par-border);
    border-radius: var(--reef-par-radius);
    display: block;
    overflow: hidden;
}
.reef-par-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: 11px;
    color: var(--reef-par-muted);
}
.reef-par-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.reef-par-legend__swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

/* ---------- Right column ---------- */
.reef-par-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.reef-par-summary__cell {
    background: rgba(4, 16, 26, 0.5);
    border: 1px solid var(--reef-par-border);
    border-radius: var(--reef-par-radius-sm);
    padding: 10px 12px;
    transition: border-color 160ms ease, background 160ms ease;
}
.reef-par-summary__cell:hover {
    border-color: var(--reef-par-border-strong);
    background: rgba(4, 16, 26, 0.65);
}
.reef-par-summary__label {
    font-size: 11px;
    color: var(--reef-par-muted);
    font-weight: 500;
}
.reef-par-summary__value {
    font-size: 22px;
    font-weight: 600;
    color: var(--reef-par-text);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.reef-par-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.reef-par-list__item {
    background: rgba(4, 16, 26, 0.4);
    border: 1px solid var(--reef-par-border);
    border-radius: var(--reef-par-radius-sm);
    padding: 12px;
    transition: border-color 160ms ease;
}
.reef-par-list__item--empty {
    color: var(--reef-par-muted);
    font-style: italic;
    text-align: center;
    background: transparent;
    border-style: dashed;
}
.reef-par-list__item:not(.reef-par-list__item--empty):hover {
    border-color: var(--reef-par-border-strong);
}
.reef-par-list__title {
    font-weight: 600;
    color: var(--reef-par-text);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.reef-par-pill {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: capitalize;
    letter-spacing: 0.01em;
}
.reef-par-pill--good   { background: rgba(63, 220, 160, 0.14);  color: #6ee2b8; }
.reef-par-pill--caution{ background: rgba(244, 168, 58, 0.16);  color: #f7c277; }
.reef-par-pill--poor   { background: rgba(255, 107, 107, 0.16); color: #ff9a9a; }

.reef-par-list__meta {
    margin-top: 4px;
    color: var(--reef-par-muted);
    font-size: 12px;
    line-height: 1.5;
}
.reef-par-list__tip {
    margin-top: 8px;
    color: var(--reef-par-text-2);
    font-size: 11px;
    font-style: italic;
}

.reef-par-warnings .reef-par-list__item--error   { border-color: rgba(255, 107, 107, 0.4); }
.reef-par-warnings .reef-par-list__item--warn    { border-color: rgba(244, 168, 58, 0.4); }
.reef-par-warnings .reef-par-list__item--info    { border-color: rgba(111, 199, 255, 0.4); }
.reef-par-warnings .reef-par-list__item--ok      { border-color: rgba(63, 220, 160, 0.4); }

.reef-par-app__footer {
    margin-top: 16px;
    border-top: 1px solid var(--reef-par-border);
    padding-top: 12px;
}
.reef-par-disclaimer {
    margin: 0;
    color: var(--reef-par-muted);
    font-size: 11px;
    text-align: center;
}

/* ---------- Toast ---------- */
@keyframes reef-par-toast-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.reef-par-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--reef-par-panel-2);
    color: var(--reef-par-text);
    padding: 10px 16px;
    border-radius: var(--reef-par-radius-xs);
    border: 1px solid var(--reef-par-border);
    font-size: 12px;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
    animation: reef-par-toast-in 180ms ease-out;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .reef-par-app *,
    .reef-par-app *::before,
    .reef-par-app *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
