/**
 * Arcform Archive Stylesheet
 *
 * Dark-theme styles for instrument archive pages, user dashboard, and
 * transfer flows. Uses canonical --arc-* design tokens from the
 * arcform-astra-child theme.
 *
 * Requires: shared.css loaded first for common components.
 *
 * @package Arcform_Archive
 * @since 2.0.0
 */

/* ==========================================================================
   Base / Reset
   ========================================================================== */

.arcform-archive,
.arcform-dashboard,
.arcform-transfer {
    font-family: var(--arc-font);
    line-height: 1.5;
    color: var(--arc-text);
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

.arcform-archive *,
.arcform-dashboard *,
.arcform-transfer * {
    box-sizing: border-box;
}

/* ==========================================================================
   Legacy Button Compat (maps .btn to dark theme)
   ========================================================================== */

.arcform-archive .btn,
.arcform-dashboard .btn,
.arcform-transfer .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75em 1.75em;
    font-family: var(--arc-font);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    border-radius: var(--arc-radius);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.btn-primary {
    background-color: var(--arc-gold);
    color: var(--arc-bg-deep);
}

.btn-primary:hover {
    background-color: var(--arc-gold-light);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--arc-gold);
    border: 1px solid var(--arc-gold-muted);
}

.btn-secondary:hover {
    background-color: rgba(204, 168, 107, 0.1);
    border-color: var(--arc-gold);
}

.btn-danger {
    background-color: var(--arc-error);
    color: #fff;
}

.btn-danger:hover {
    background-color: #c4644d;
}

.btn-sm {
    padding: 0.5em 1.25em;
    font-size: 0.75rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ==========================================================================
   Archive Header
   ========================================================================== */

.archive-header {
    background: var(--arc-bg-surface);
    color: var(--arc-text);
    padding: 32px 24px;
    margin: -24px -24px 24px -24px;
    text-align: center;
    border-bottom: 1px solid var(--arc-border);
}

.archive-header-content {
    max-width: 640px;
    margin: 0 auto;
}

.stolen-banner {
    background: var(--arc-error);
    color: #fff;
    padding: 12px 20px;
    margin: -32px -24px 20px -24px;
    font-weight: 600;
    text-align: center;
}

.verification-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.verification-badge.verified {
    background: rgba(95, 206, 171, 0.15);
    color: var(--arc-teal);
}

.verification-badge.unverified {
    background: var(--arc-bg-elevated);
    color: var(--arc-text-muted);
}

.instrument-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--arc-text);
    margin: 0 0 6px 0;
}

.instrument-model {
    font-size: 1.0625rem;
    color: var(--arc-text-sec);
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.instrument-serial {
    font-size: 0.8125rem;
    color: var(--arc-text-muted);
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ==========================================================================
   Lending Status Banner
   ========================================================================== */

.lending-banner {
    background: rgba(123, 163, 201, 0.15);
    border: 1px solid rgba(123, 163, 201, 0.3);
    color: var(--arc-info);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--arc-radius);
    margin-bottom: 20px;
    font-size: 0.9375rem;
}

/* ==========================================================================
   Photo Gallery
   ========================================================================== */

.archive-gallery {
    margin-bottom: 32px;
}

.gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
    overflow: hidden;
    margin-bottom: 10px;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
}

.gallery-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--arc-text-muted);
}

.gallery-placeholder span {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
}

.gallery-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--arc-radius);
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.gallery-thumb:hover,
.gallery-thumb.active {
    opacity: 1;
    border-color: var(--arc-gold);
}

/* ==========================================================================
   Health Score
   ========================================================================== */

.health-score-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
    padding: 20px 24px;
    margin-bottom: 32px;
}

.health-score-card .health-grade {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.health-grade-A { color: #5FCEAB; }
.health-grade-B { color: #8BC34A; }
.health-grade-C { color: var(--arc-gold); }
.health-grade-D { color: var(--arc-error); }
.health-grade-F { color: #c62828; }

.health-score-info {
    flex: 1;
}

.health-score-info h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    color: var(--arc-text);
}

.health-score-info p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--arc-text-sec);
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */

.archive-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

@media (max-width: 640px) {
    .archive-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    padding: 20px 16px;
    border-radius: var(--arc-radius-lg);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--arc-text);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--arc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
}

/* ==========================================================================
   Sections
   ========================================================================== */

.archive-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--arc-text);
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--arc-border);
}

/* ==========================================================================
   Specifications Grid
   ========================================================================== */

.specs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

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

.spec-item {
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    padding: 16px;
    border-radius: var(--arc-radius-lg);
}

.spec-label {
    display: block;
    font-size: 0.7rem;
    color: var(--arc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.spec-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--arc-text);
}

/* ==========================================================================
   Story / Timeline
   ========================================================================== */

.builder-notes {
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    padding: 20px;
    border-radius: var(--arc-radius-lg);
    margin-bottom: 24px;
    border-left: 4px solid var(--arc-gold);
}

.builder-notes h3 {
    margin: 0 0 10px 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--arc-gold);
}

.builder-notes p {
    margin: 0;
    font-style: italic;
    color: var(--arc-text-sec);
    line-height: 1.7;
}

.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--arc-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -32px;
    top: 0;
    width: 18px;
    height: 18px;
    background: var(--arc-bg-surface);
    border: 2px solid var(--arc-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--arc-text-muted);
}

.timeline-item.verified .timeline-marker {
    background: var(--arc-teal);
    border-color: var(--arc-teal);
    color: #fff;
}

.timeline-date {
    display: block;
    font-size: 0.75rem;
    color: var(--arc-text-muted);
    margin-bottom: 4px;
}

.timeline-title {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--arc-text);
}

.timeline-narrative {
    margin: 0;
    color: var(--arc-text-sec);
    font-size: 0.875rem;
    line-height: 1.6;
}

/* ==========================================================================
   Ownership Chain
   ========================================================================== */

.ownership-chain {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ownership-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
}

.ownership-item.current {
    background: rgba(204, 168, 107, 0.06);
    border-color: var(--arc-gold-muted);
}

.ownership-number {
    width: 32px;
    height: 32px;
    background: var(--arc-bg-elevated);
    color: var(--arc-text-sec);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.ownership-item.current .ownership-number {
    background: var(--arc-gold);
    color: var(--arc-bg-deep);
}

.ownership-details {
    flex: 1;
}

.ownership-name {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    color: var(--arc-text);
}

.ownership-period {
    display: block;
    font-size: 0.875rem;
    color: var(--arc-text-muted);
    margin-top: 2px;
}

.ownership-type {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--arc-text-muted);
    background: var(--arc-bg-elevated);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ==========================================================================
   Modifications
   ========================================================================== */

.modifications-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modification-item {
    padding: 16px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
}

.mod-date {
    display: block;
    font-size: 0.75rem;
    color: var(--arc-text-muted);
    margin-bottom: 6px;
}

.mod-title {
    margin: 0 0 6px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--arc-text);
}

.mod-description {
    margin: 0 0 10px 0;
    color: var(--arc-text-sec);
    font-size: 0.875rem;
    line-height: 1.6;
}

.mod-by {
    font-size: 0.75rem;
    color: var(--arc-text-muted);
}

/* ==========================================================================
   Performances
   ========================================================================== */

.performances-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.performance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
}

.performance-info {
    flex: 1;
}

.performance-title {
    font-weight: 600;
    color: var(--arc-text);
    display: block;
}

.performance-meta {
    font-size: 0.8125rem;
    color: var(--arc-text-muted);
    margin-top: 4px;
}

.performance-links a {
    color: var(--arc-gold);
    font-size: 0.8125rem;
    text-decoration: none;
}

.performance-links a:hover {
    color: var(--arc-gold-light);
}

/* ==========================================================================
   Practice Summary
   ========================================================================== */

.practice-summary-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (max-width: 640px) {
    .practice-summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   Owner Actions
   ========================================================================== */

.owner-actions .action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Owner panel — sticky bar */
.owner-panel {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-gold-muted);
    border-radius: var(--arc-radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.owner-panel__label {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--arc-gold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.owner-panel__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   NFC Info
   ========================================================================== */

.nfc-info {
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    padding: 20px;
    border-radius: var(--arc-radius-lg);
}

.nfc-details {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--arc-border);
}

.nfc-details:last-child {
    border-bottom: none;
}

.nfc-label {
    color: var(--arc-text-muted);
    font-size: 0.875rem;
}

.nfc-uid {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    background: var(--arc-bg-elevated);
    color: var(--arc-text-sec);
    padding: 2px 8px;
    border-radius: 4px;
}

.nfc-count,
.nfc-date {
    color: var(--arc-text-sec);
    font-size: 0.875rem;
}

/* ==========================================================================
   Footer Actions
   ========================================================================== */

.archive-footer {
    text-align: center;
    padding: 32px 0 16px;
    border-top: 1px solid var(--arc-border);
    margin-top: 40px;
}

.archive-footer .action-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.archive-footer .verify-prompt {
    font-size: 0.875rem;
    color: var(--arc-text-muted);
    font-style: italic;
}

/* ==========================================================================
   Dashboard Styles
   ========================================================================== */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.dashboard-header h1 {
    margin: 0;
    color: var(--arc-text);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

@media (max-width: 500px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
}

.dashboard-stat {
    background: linear-gradient(135deg, rgba(204, 168, 107, 0.15) 0%, rgba(204, 168, 107, 0.05) 100%);
    border: 1px solid var(--arc-gold-muted);
    color: var(--arc-text);
    padding: 24px;
    border-radius: var(--arc-radius-lg);
    text-align: center;
}

.dashboard-stat .stat-value {
    font-size: 2.25rem;
    color: var(--arc-gold-light);
}

.dashboard-stat .stat-label {
    color: var(--arc-text-sec);
}

.instruments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.instrument-card {
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.instrument-card:hover {
    border-color: var(--arc-gold-muted);
    transform: translateY(-2px);
}

.instrument-card-image {
    aspect-ratio: 4/3;
    background: var(--arc-bg-elevated);
}

.instrument-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.instrument-card-content {
    padding: 16px;
}

.instrument-card-name {
    font-size: 1.0625rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--arc-text);
}

.instrument-card-model {
    font-size: 0.8125rem;
    color: var(--arc-text-muted);
    margin: 0 0 10px 0;
}

.instrument-card-stats {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--arc-text-muted);
}

/* ==========================================================================
   Transfer Styles
   ========================================================================== */

.transfer-card {
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.transfer-instrument {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.transfer-instrument-image {
    width: 120px;
    height: 90px;
    background: var(--arc-bg-elevated);
    border-radius: var(--arc-radius-lg);
    overflow: hidden;
    flex-shrink: 0;
}

.transfer-instrument-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.transfer-details h3 {
    margin: 0 0 5px 0;
    color: var(--arc-text);
}

.transfer-details p {
    margin: 0;
    color: var(--arc-text-muted);
    font-size: 0.875rem;
}

.transfer-from {
    padding: 16px;
    background: var(--arc-bg-elevated);
    border-radius: var(--arc-radius-lg);
    margin-bottom: 16px;
}

.transfer-from-label {
    font-size: 0.7rem;
    color: var(--arc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.transfer-from-name {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--arc-text);
}

.transfer-message {
    padding: 16px;
    background: rgba(204, 168, 107, 0.06);
    border-left: 4px solid var(--arc-gold);
    border-radius: 0 var(--arc-radius) var(--arc-radius) 0;
    margin-bottom: 20px;
    color: var(--arc-text-sec);
}

.transfer-actions {
    display: flex;
    gap: 10px;
}

.transfer-actions .btn {
    flex: 1;
}

/* ==========================================================================
   Forms (legacy compat — prefer arc-* classes from shared.css)
   ========================================================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--arc-text);
    font-size: 0.875rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--arc-font);
    font-size: 0.9375rem;
    color: var(--arc-text);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius);
    background: var(--arc-bg-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--arc-gold);
    box-shadow: 0 0 0 2px rgba(204, 168, 107, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--arc-text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--arc-text-muted);
    margin-top: 6px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ==========================================================================
   Alerts / Messages
   ========================================================================== */

.arcform-alert {
    padding: 14px 20px;
    border-radius: var(--arc-radius);
    margin-bottom: 20px;
    font-size: 0.9375rem;
}

.arcform-alert-success {
    background: rgba(95, 206, 171, 0.1);
    border: 1px solid rgba(95, 206, 171, 0.3);
    color: var(--arc-teal);
}

.arcform-alert-warning {
    background: rgba(204, 168, 107, 0.1);
    border: 1px solid rgba(204, 168, 107, 0.3);
    color: var(--arc-gold-light);
}

.arcform-alert-error {
    background: rgba(224, 122, 95, 0.1);
    border: 1px solid rgba(224, 122, 95, 0.3);
    color: var(--arc-error);
}

.arcform-error {
    color: var(--arc-error);
    padding: 20px;
    text-align: center;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.arcform-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--arc-text-muted);
    gap: 12px;
}

.arcform-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--arc-border);
    border-top-color: var(--arc-gold);
    border-radius: 50%;
    animation: arcArchiveSpin 0.8s linear infinite;
}

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

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--arc-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    color: var(--arc-text-sec);
}

.empty-state p {
    margin: 0 0 20px 0;
}

/* ==========================================================================
   Modal Styles (legacy compat — prefer arc-modal from shared.css)
   ========================================================================== */

.arcform-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-dialog {
    position: relative;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--arc-border);
}

.modal-title {
    margin: 0;
    font-size: 1.125rem;
    color: var(--arc-text);
}

.modal-header .modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--arc-text-muted);
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-header .modal-close:hover {
    color: var(--arc-text);
}

.modal-body {
    padding: 24px;
}

/* ==========================================================================
   Lightbox (legacy compat)
   ========================================================================== */

.arcform-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--arc-radius);
}

.lightbox-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

body.lightbox-open {
    overflow: hidden;
}

/* ==========================================================================
   Notifications (legacy compat)
   ========================================================================== */

.arcform-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--arc-bg-elevated);
    border: 1px solid var(--arc-border);
    padding: 14px 20px;
    border-radius: var(--arc-radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 99998;
    animation: arcArchiveSlideIn 0.3s ease;
}

@keyframes arcArchiveSlideIn {
    from { transform: translateX(100px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.notification-success {
    border-left: 3px solid var(--arc-teal);
}

.notification-error {
    border-left: 3px solid var(--arc-error);
}

.notification-loading {
    border-left: 3px solid var(--arc-gold);
}

.notification-icon {
    font-size: 1.125rem;
}

.notification-success .notification-icon {
    color: var(--arc-teal);
}

.notification-error .notification-icon {
    color: var(--arc-error);
}

.notification-message {
    color: var(--arc-text);
    font-size: 0.9375rem;
}

/* ==========================================================================
   Dashboard Extensions
   ========================================================================== */

.dashboard-level {
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-badge {
    background: var(--arc-gold);
    color: var(--arc-bg-deep);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 700;
}

.level-title {
    color: var(--arc-text-muted);
    font-size: 0.875rem;
}

.active-session-banner {
    background: rgba(204, 168, 107, 0.08);
    border: 2px solid var(--arc-gold-muted);
    border-radius: var(--arc-radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.session-icon {
    font-size: 1.75rem;
}

.session-info {
    flex: 1;
}

.session-info strong {
    display: block;
    color: var(--arc-text);
}

.session-info span {
    font-size: 0.875rem;
    color: var(--arc-text-muted);
}

.earn-back-card {
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    padding: 20px;
    border-radius: var(--arc-radius-lg);
    margin-bottom: 32px;
}

.earn-back-card h3 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    color: var(--arc-text);
}

.progress-bar {
    height: 10px;
    background: var(--arc-bg-elevated);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--arc-gold) 0%, var(--arc-gold-light) 100%);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.earn-back-card p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--arc-text-muted);
}

.earn-back-achieved {
    background: rgba(95, 206, 171, 0.08);
    border: 2px solid var(--arc-teal);
    border-radius: var(--arc-radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
    color: var(--arc-teal);
}

.earn-back-achieved .badge-icon {
    font-size: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
    color: var(--arc-text);
}

.instrument-count,
.badge-count {
    background: var(--arc-bg-elevated);
    color: var(--arc-text-sec);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
}

.activity-icon {
    font-size: 1.25rem;
}

.activity-content {
    flex: 1;
}

.activity-text {
    display: block;
    font-size: 0.875rem;
    color: var(--arc-text-sec);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--arc-text-muted);
}

.activity-points {
    font-weight: 600;
    color: var(--arc-teal);
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.badge-item {
    text-align: center;
    padding: 16px 10px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
}

.badge-item.locked {
    opacity: 0.4;
}

.badge-item .badge-icon {
    font-size: 1.75rem;
    display: block;
    margin-bottom: 6px;
}

.badge-name {
    font-size: 0.75rem;
    display: block;
    color: var(--arc-text-sec);
}

.badge-progress {
    margin-top: 6px;
}

.progress-mini {
    height: 4px;
    background: var(--arc-gold);
    border-radius: 2px;
}

.transfers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.transfer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
}

.transfer-info strong {
    display: block;
    color: var(--arc-text);
}

.transfer-info span {
    font-size: 0.875rem;
    color: var(--arc-text-muted);
}

.transfer-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pending_buyer,
.status-pending_nfc {
    background: rgba(204, 168, 107, 0.15);
    color: var(--arc-gold-light);
}

/* ==========================================================================
   Transfer Form / Accept Page
   ========================================================================== */

.nfc-prompt {
    text-align: center;
    padding: 40px 24px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
    margin: 20px 0;
}

.nfc-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: arcPulse 2s infinite;
}

@keyframes arcPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.nfc-prompt h3 {
    margin: 0 0 10px 0;
    color: var(--arc-text);
}

.nfc-prompt p {
    margin: 0;
    color: var(--arc-text-sec);
}

.transfer-price {
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    padding: 20px;
    border-radius: var(--arc-radius-lg);
    text-align: center;
    margin: 20px 0;
}

.price-label {
    display: block;
    font-size: 0.875rem;
    color: var(--arc-text-muted);
    margin-bottom: 6px;
}

.price-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--arc-gold-light);
}

.price-note {
    margin: 10px 0 0 0;
    font-size: 0.875rem;
    color: var(--arc-text-muted);
}

.transfer-type-badge {
    display: inline-block;
    background: rgba(204, 168, 107, 0.12);
    color: var(--arc-gold);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    margin: 16px 0;
}

.login-required {
    text-align: center;
    padding: 24px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
}

.login-required p {
    margin: 0 0 16px 0;
    color: var(--arc-text-sec);
}

.register-link {
    margin-top: 16px;
    font-size: 0.875rem;
}

.transfer-expiry {
    text-align: center;
    margin-top: 20px;
    font-size: 0.875rem;
    color: var(--arc-text-muted);
}

.transfer-note {
    background: rgba(204, 168, 107, 0.08);
    border-left: 4px solid var(--arc-gold);
    padding: 16px;
    border-radius: 0 var(--arc-radius) var(--arc-radius) 0;
    font-size: 0.875rem;
    color: var(--arc-text-sec);
}

.transfer-step.hidden {
    display: none;
}

.transfer-instrument-preview {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius-lg);
    margin-bottom: 32px;
}

.instrument-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--arc-bg-elevated);
    font-size: 3rem;
    color: var(--arc-text-muted);
    opacity: 0.5;
}

.instrument-selectable {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.instrument-selectable:hover {
    transform: translateY(-4px);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
    .arcform-archive,
    .arcform-dashboard,
    .arcform-transfer {
        padding: 16px;
    }

    .archive-header {
        padding: 24px 16px;
        margin: -16px -16px 20px -16px;
    }

    .instrument-name {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.125rem;
    }

    .owner-actions .action-buttons {
        flex-direction: column;
    }

    .owner-actions .btn {
        width: 100%;
    }

    .owner-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .owner-panel__actions {
        justify-content: stretch;
    }

    .owner-panel__actions .btn {
        flex: 1;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0;
}

.mt-20 {
    margin-top: 20px;
}

/* ==========================================================================
   Archive Browse / Search
   ========================================================================== */

.arcform-archive-browse {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.archive-browse-header {
    text-align: center;
    margin-bottom: 32px;
}

.archive-browse-header h1 {
    font-family: var(--arc-font);
    font-size: 2rem;
    font-weight: 700;
    color: var(--arc-text);
    margin: 0 0 8px;
}

.archive-browse-header p {
    font-size: 1.0625rem;
    margin: 0;
}

/* ─── Legendary featured row (Archive Phase 6) ───
   Sits above the main archive controls. Gold-framed cards, slightly
   raised; differentiates the curated tier from the unranked grid below
   without screaming. */
.archive-legendary-section {
    margin: 24px 0 32px;
    padding: 24px;
    background: linear-gradient(180deg, rgba(204, 168, 107, 0.06), transparent 80%);
    border: 1px solid rgba(204, 168, 107, 0.25);
    border-radius: var(--arc-radius-lg, 12px);
}
.archive-legendary-heading {
    color: var(--arc-text-gold, #E0C992);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.archive-legendary-mark {
    color: var(--arc-gold, #CCA86B);
    font-size: 1.25em;
}
.archive-legendary-sub {
    color: var(--arc-text-muted, #6B6B75);
    font-size: 0.9rem;
    margin: 0 0 18px;
}
.archive-legendary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.archive-legendary-card {
    display: flex;
    flex-direction: column;
    background-color: var(--arc-bg-surface, #1A1A1F);
    border: 1px solid var(--arc-gold-muted, #8C7B5A);
    border-radius: var(--arc-radius, 6px);
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
}
.archive-legendary-card:hover {
    transform: translateY(-2px);
    border-color: var(--arc-gold, #CCA86B);
    box-shadow: 0 6px 24px rgba(204, 168, 107, 0.18);
}
.archive-legendary-frame {
    position: relative;
    aspect-ratio: 4 / 3;
    background-color: var(--arc-bg-elevated, #252530);
    overflow: hidden;
}
.archive-legendary-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.archive-legendary-frame .instrument-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--arc-text-muted);
    font-size: 2.5rem;
}
.archive-legendary-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--arc-gold, #CCA86B);
    color: var(--arc-bg-deep, #0D0D0F);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: var(--arc-radius, 6px);
}
.archive-legendary-meta {
    padding: 12px 14px;
}
.archive-legendary-title {
    color: var(--arc-text, #FFFFFF);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.25;
}
.archive-legendary-date {
    color: var(--arc-text-muted);
    font-size: 0.78rem;
    margin: 0;
}

.archive-browse-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
}

/* All / Mine segmented toggle. Only rendered server-side when the user
   is logged in. Sits to the left of the search input. */
.archive-browse-scope {
    display: inline-flex;
    flex-shrink: 0;
    background-color: var(--arc-bg-surface);
    border: 1px solid var(--arc-border);
    border-radius: var(--arc-radius);
    padding: 3px;
    gap: 2px;
}

.archive-browse-scope__btn {
    background: transparent !important;
    color: var(--arc-text-muted) !important;
    border: none !important;
    border-radius: calc(var(--arc-radius) - 2px) !important;
    padding: 0.5rem 1rem !important;
    font-family: var(--arc-font);
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.archive-browse-scope__btn:hover {
    color: var(--arc-text) !important;
    background-color: transparent !important;
    transform: none !important;
}

.archive-browse-scope__btn.is-active {
    background-color: var(--arc-gold) !important;
    color: var(--arc-bg-deep) !important;
}

.archive-browse-scope__btn.is-active:hover {
    background-color: var(--arc-gold-light) !important;
    color: var(--arc-bg-deep) !important;
}

.archive-browse-search {
    flex: 1;
    min-width: 0;
}

.archive-browse-search .arc-input {
    width: 100%;
    font-size: 0.9375rem;
}

.archive-browse-filters {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.archive-browse-filters .arc-select {
    min-width: 140px;
}

.archive-browse-meta {
    margin-bottom: 16px;
    font-size: 0.8125rem;
    color: var(--arc-text-muted);
}

.archive-browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.archive-browse-grid .instrument-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 2.5rem;
    color: var(--arc-text-muted);
    background-color: var(--arc-bg-elevated);
}

.archive-browse-grid .instrument-card-serial {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
    color: var(--arc-text-muted);
    margin: 4px 0 0;
}

.archive-browse-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px 0;
}

.arc-pagination__dots {
    color: var(--arc-text-muted);
    padding: 0 4px;
}

@media (max-width: 768px) {
    .archive-browse-controls {
        flex-direction: column;
    }

    .archive-browse-scope {
        align-self: flex-start;
    }

    .archive-browse-filters {
        flex-wrap: wrap;
    }

    .archive-browse-filters .arc-select {
        flex: 1;
        min-width: 120px;
    }

    .archive-browse-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .arcform-archive-browse {
        padding: 24px 16px;
    }

    .archive-browse-header h1 {
        font-size: 1.5rem;
    }

    .archive-browse-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Archive proxy detail page — used on consumer sites (arcformguitars.com)
   when /archive/{uid}/ resolves through the rewrite + Archive_Proxy.
   Local single-CPT instrument pages on be-authentic.me use the partials
   in templates/partials/archive/ and have their own styles.
   ========================================================================== */

.archive-detail-header {
    text-align: center;
    margin-bottom: 32px;
}

.archive-detail-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    margin: 8px 0;
}

.archive-detail-hero {
    margin: 0 0 32px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--arc-bg-elevated, #252530);
}

.archive-detail-hero img {
    width: 100%;
    height: auto;
    display: block;
}

.archive-detail-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    padding: 20px;
    background: var(--arc-bg-surface, #1A1A1F);
    border: 1px solid var(--arc-border, #2E2E3A);
    border-radius: 12px;
    margin-bottom: 32px;
}

.archive-detail-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.archive-detail-stat__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--arc-text-muted, #6B6B75);
}

.archive-detail-stat__value {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--arc-text-primary, #FFFFFF);
}

.archive-detail-stat__value--gold {
    color: var(--arc-gold-light, #E0C992);
}

.archive-detail-stat__value--mono {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 1rem;
}

.archive-detail-block {
    margin-bottom: 32px;
    padding: 24px;
    background: var(--arc-bg-surface, #1A1A1F);
    border: 1px solid var(--arc-border, #2E2E3A);
    border-radius: 12px;
}

.archive-detail-block__heading {
    font-size: 1.1rem;
    margin: 0 0 16px;
    color: var(--arc-gold-light, #E0C992);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.archive-detail-specs {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 24px;
    margin: 0;
}

.archive-detail-specs dt {
    color: var(--arc-text-secondary, #A0A0A8);
    font-size: 0.9rem;
}

.archive-detail-specs dd {
    margin: 0;
    color: var(--arc-text-primary, #FFFFFF);
}

.archive-detail-history {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.archive-detail-history__item {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 12px;
    align-items: baseline;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--arc-border, #2E2E3A);
}

.archive-detail-history__item:last-child {
    border-bottom: 0;
}

.archive-detail-history__date {
    color: var(--arc-text-secondary, #A0A0A8);
    font-size: 0.85rem;
}

.archive-detail-history__snap {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--arc-text-muted, #6B6B75);
}

.archive-detail-footer {
    text-align: center;
    padding: 16px 0 0;
}

@media (max-width: 600px) {
    .archive-detail-history__item {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* ==========================================================================
   Theme-defense — Astra (and other heavy form-styled parent themes) on
   consumer sites override .arc-input/.arc-select with white backgrounds,
   which collides with the dark plugin defaults and renders dropdown text
   white-on-white. Re-assert dark surface + light text inside the archive
   browse container with enough specificity to win.
   ========================================================================== */
.arcform-archive-browse .arc-input,
.arcform-archive-browse .arc-select {
    background-color: var(--arc-bg-surface, #1A1A1F);
    color: var(--arc-text, #FFFFFF);
    border: 1px solid var(--arc-border, #2E2E3A);
}

.arcform-archive-browse .arc-input::placeholder {
    color: var(--arc-text-muted, #6B6B75);
}

/* Native <option> rendering uses the OS dropdown widget; setting both
   bg + color keeps it readable when expanded. */
.arcform-archive-browse .arc-select option {
    background-color: var(--arc-bg-surface, #1A1A1F);
    color: var(--arc-text, #FFFFFF);
}
