/* =========================================================================
Admin Control Panel — Components
   =========================================================================

Extracted from the Leptos `<style>` blocks that used to sit inside these
components. Those blocks only existed in the DOM while their component was
mounted, which made cross-panel styling depend on what happened to be on
screen, and made the same rule easy to declare twice with different values.

Sources:
     - apps/frontend-admin/src/ui/components/sync_status_banner.rs
   ========================================================================= */

/* ---- sync_status_banner.rs ---- */
         .sync-banner {
             background: var(--bg-tertiary); border: 1px solid var(--border-primary);
             border-radius: var(--radius-xl); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-5);
             display: flex; flex-direction: column; gap: var(--space-2-5);
         }
         .sync-banner.running { border-color: var(--accent-color); }
         .sync-banner.completed { border-color: var(--chart-cat-2); }
         .sync-banner.failed { border-color: var(--danger-color); }
         .sync-banner-head { display: flex; align-items: center; gap: var(--space-2-5); }
         .sync-banner-phase { font-weight: 600; }
         .sync-banner-count { color: var(--text-secondary); font-size: 0.85rem; margin-left: auto; }
         .sync-banner-bar {
             background: var(--bg-primary); border: 1px solid var(--border-primary);
             border-radius: var(--radius-md); height: 0.6rem; overflow: hidden;
         }
         .sync-banner-fill { height: 100%; background: var(--accent-color); transition: width 0.3s; }
         .sync-banner-warnings { font-size: 0.85rem; color: var(--text-secondary); }
         .sync-banner-warnlist {
             margin-top: var(--space-1-5); max-height: 200px; overflow-y: auto;
             display: flex; flex-direction: column; gap: var(--space-1);
             font-size: 0.8rem; color: var(--danger-color);
             background: var(--bg-primary); border: 1px solid var(--border-primary);
             border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3);
         }
         @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
         .sync-banner .sync-spinner {
             width: 1em; height: 1em; border-radius: var(--radius-round);
             border: 2px solid color-mix(in srgb, var(--text-color) 30%, transparent); border-top-color: var(--accent-color);
             animation: spin 0.75s linear infinite; flex-shrink: 0;
         }
     

/* ---- styles.rs (was const IMPORT_VERIFICATION_STYLES) ---- */
.import-verification-modal {
 max-width: 1100px !important;
 width: 95% !important;
 max-height: 90vh !important;
 display: flex;
 flex-direction: column;
}

.import-stats {
 display: flex;
 gap: var(--space-6);
 font-size: 0.95rem;
 color: var(--text-secondary);
 margin-top: var(--space-2);
 font-weight: 600;
}

.stat.approved { color: var(--success-color); }
.stat.rejected { color: var(--danger-color); }
.stat.remaining { color: var(--text-secondary); opacity: 0.7; }

.modal-body {
 flex: 1;
 overflow-y: auto;
 padding: var(--space-8);
 min-height: 0; /* Important for flex-basis: auto to allow shrinking */
}

.batch-actions {
 display: flex;
 gap: var(--space-4);
 margin-bottom: var(--space-8);
}

.batch-actions button {
 flex: 1;
 display: flex;
 align-items: center;
 justify-content: center;
 gap: var(--space-3);
 padding: var(--space-3-5);
 border-radius: var(--radius-xl);
 border: 1px solid var(--border-primary);
 background: var(--bg-tertiary);
 color: var(--text-primary);
 cursor: pointer;
 transition: all 0.2s;
 font-weight: 600;
}

.btn-approve-all:hover { background: var(--success-bg); border-color: var(--success-color); color: var(--success-color); }
.btn-reject-all:hover { background: var(--danger-bg); border-color: var(--danger-color); color: var(--danger-color); }

.verification-list {
 display: flex;
 flex-direction: column;
 gap: var(--space-8);
 margin-bottom: var(--space-8);
 min-height: 500px;
}

.verification-card {
 display: flex;
 gap: var(--space-10);
 padding: var(--space-8);
 background: var(--bg-secondary);
 border: 1px solid var(--border-primary);
 border-radius: var(--radius-3xl);
 animation: slideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
 box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

@keyframes slideIn {
 from { opacity: 0; transform: translateY(20px); }
 to { opacity: 1; transform: translateY(0); }
}

.card-image-preview {
 width: 160px;
 flex-shrink: 0;
 position: relative;
 z-index: 0;
 pointer-events: auto;
}

/* The hovered preview rises over the other rows' previews. Every preview is
   its own stacking context, so the zoomed card's lift has to be the preview's:
   a z-index on the card inside stayed local, and the next row covered it. */
.card-image-preview:hover {
 z-index: 1;
}

.card-image-preview .card-item {
 width: 100%;
 height: auto;
 border-radius: var(--radius-xl);
 box-shadow: 0 4px 24px rgba(0,0,0,0.5);
 transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-image-preview:hover .card-item {
 transform: scale(1.75);
 box-shadow: 0 12px 48px rgba(0,0,0,0.8);
}

.verification-info {
 flex: 1;
 display: flex;
 flex-direction: column;
 gap: var(--space-6);
}

.card-name {
 font-weight: 800;
 font-size: 1.6rem;
 color: var(--text-color);
 border-bottom: 2px solid var(--border-primary);
 padding-bottom: var(--space-3);
 letter-spacing: -0.02em;
}

.tags-container {
 display: flex;
 flex-direction: column;
 gap: var(--space-5);
}

.tag-verification-row {
 display: grid;
 grid-template-columns: 220px 1fr;
 gap: var(--space-4) var(--space-6);
 align-items: start;
 padding: var(--space-5);
 background: color-mix(in srgb, var(--bg-tertiary) 40%, transparent);
 border-radius: var(--radius-2xl);
 border: 1px solid color-mix(in srgb, var(--border-primary) 60%, transparent);
 transition: background-color 0.2s;
}

.tag-verification-row:hover {
 background: color-mix(in srgb, var(--bg-tertiary) 60%, transparent);
}

.tag-identity {
 display: flex;
 flex-direction: column;
 gap: var(--space-2-5);
}

.tag-badge {
 padding: var(--space-1-5) var(--space-4);
 background: rgba(var(--color-accent-rgb), 0.12);
 color: var(--text-accent);
 border: 1px solid rgba(var(--color-accent-rgb), 0.25);
 border-radius: var(--radius-md);
 font-size: 0.95rem;
 font-weight: 700;
 text-align: center;
 box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tag-category-label {
 color: var(--text-secondary);
 font-size: 0.85rem;
 font-style: italic;
 text-align: center;
 opacity: 0.8;
}

.tag-metadata-editor-dropdowns {
 display: flex;
 flex-direction: column;
 gap: var(--space-3);
}

.metadata-dropdown-row {
 display: flex;
 gap: var(--space-2);
 align-items: center;
}

.tag-metadata-editor-dropdowns select {
 flex: 1;
 background: color-mix(in srgb, var(--bg-color) 40%, transparent);
 border: 1px solid var(--border-primary);
 border-radius: var(--radius-md);
 color: var(--text-primary);
 padding: var(--space-2) var(--space-3);
 font-size: 0.9rem;
 cursor: pointer;
 transition: border-color 0.2s;
}

.tag-metadata-editor-dropdowns select:focus {
 outline: none;
 border-color: var(--color-accent);
}

.btn-remove-meta {
 background: none;
 border: none;
 color: var(--danger-color);
 cursor: pointer;
 padding: var(--space-1);
 display: flex;
 align-items: center;
 justify-content: center;
 opacity: 0.6;
 transition: opacity 0.2s;
}

.btn-remove-meta:hover {
 opacity: 1;
}

.btn-add-meta {
 align-self: flex-start;
 background: none;
 border: 1px dashed var(--border-primary);
 color: var(--text-secondary);
 font-size: 0.8rem;
 padding: var(--space-1) var(--space-2-5);
 border-radius: var(--radius-sm);
 cursor: pointer;
 display: flex;
 align-items: center;
 gap: var(--space-1-5);
 transition: all 0.2s;
}

.btn-add-meta:hover {
 color: var(--text-accent);
 border-color: var(--color-accent);
 background: rgba(var(--color-accent-rgb), 0.05);
}

.tag-actions {
 grid-column: 1 / -1;
 display: flex;
 gap: var(--space-4);
 justify-content: flex-end;
 border-top: 1px solid color-mix(in srgb, var(--border-primary) 15%, transparent);
 padding-top: var(--space-4);
}

.btn-action {
 width: 64px;
 height: 64px;
 display: flex;
 align-items: center;
 justify-content: center;
 border-radius: var(--radius-2xl);
 border: 2px solid var(--border-primary);
 background: var(--bg-tertiary);
 cursor: pointer;
 transition: all 0.2s;
 box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-action svg {
 filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.btn-action.approve {
 color: var(--success-color);
 border-color: var(--success-bg-hover);
 background: var(--success-bg);
}
.btn-action.approve:hover {
 background: var(--success-bg-hover);
 border-color: var(--success-color);
 transform: scale(1.1);
 box-shadow: 0 0 15px var(--success-border);
}

.btn-action.reject {
 color: var(--danger-color);
 border-color: var(--danger-bg-hover);
 background: var(--danger-bg);
}
.btn-action.reject:hover {
 background: var(--danger-bg-hover);
 border-color: var(--danger-color);
 transform: scale(1.1);
 box-shadow: 0 0 15px var(--danger-border);
}

.pagination {
 display: flex;
 align-items: center;
 justify-content: center;
 gap: var(--space-10);
 color: var(--text-secondary);
 padding: var(--space-8) 0 var(--space-4) 0;
 border-top: 1px solid var(--border-primary);
}

.btn-finalize {
 background: var(--color-accent);
 color: color-mix(in srgb, var(--bg-color) 100%, transparent);
 padding: var(--space-4) var(--space-10);
 border: none;
 border-radius: var(--radius-xl);
 font-weight: 800;
 font-size: 1.1rem;
 cursor: pointer;
 transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
 box-shadow: 0 4px 12px rgba(var(--color-accent-rgb), 0.3);
}

.btn-finalize:hover:not(:disabled) {
 transform: translateY(-2px);
 background: var(--button-primary-text);
 box-shadow: 0 6px 20px color-mix(in srgb, var(--text-color) 40%, transparent);
}

.btn-finalize:disabled {
 background: var(--bg-tertiary);
 color: var(--text-secondary);
 cursor: not-allowed;
 opacity: 0.4;
 box-shadow: none;
}

.loading-state {
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 padding: 4rem;
 color: var(--text-secondary);
}

.spinner {
 width: 40px;
 height: 40px;
 border: 3px solid color-mix(in srgb, var(--text-color) 10%, transparent);
 border-radius: var(--radius-round);
 border-top-color: var(--accent-primary);
 animation: spin 1s ease-in-out infinite;
 margin-bottom: var(--space-6);
}

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

@media (max-width: 768px) {
 .import-verification-modal {
     width: 100% !important;
     height: 100% !important;
     max-height: 100vh !important;
     max-width: 100vw !important;
     margin: 0 !important;
     border-radius: 0 !important;
 }

 .modal-header {
     padding: var(--space-4);
 }

 .modal-header h3 {
     font-size: 1.15rem;
 }

 .import-stats {
     gap: var(--space-2);
     font-size: 0.75rem;
 }

 .modal-body {
     padding: var(--space-3) !important;
 }

 .batch-actions {
     flex-direction: column;
     gap: var(--space-2);
     margin-bottom: var(--space-4);
 }

 .batch-actions button {
     padding: var(--space-2-5);
     font-size: 0.9rem;
 }

 .verification-list {
     gap: var(--space-4);
 }

 .verification-card {
     flex-direction: column;
     padding: var(--space-4);
     gap: var(--space-4);
     align-items: stretch;
 }

 .card-image-preview {
     width: 120px;
     margin: 0 auto;
 }

 .card-image-preview:hover img {
     transform: scale(1.1);
 }

 .card-name {
     font-size: 1.2rem;
     text-align: center;
     padding-bottom: var(--space-2);
 }

 .tag-verification-row {
     display: flex;
     flex-direction: column;
     grid-template-columns: none;
     gap: var(--space-4);
     padding: var(--space-3);
 }

 .tag-identity {
     flex-direction: column;
     align-items: flex-start;
     gap: var(--space-1-5);
 }

 .tag-badge {
     width: 100%;
     max-width: none;
     font-size: 0.85rem;
     padding: var(--space-1);
 }

 .tag-category-label {
     font-size: 0.75rem;
     text-align: left;
 }

 .tag-metadata-editor-dropdowns {
     width: 100%;
 }

 .metadata-dropdown-row {
     flex-wrap: wrap;
     gap: var(--space-2);
 }

 .metadata-dropdown-row select {
     flex: 1 1 120px;
     min-width: 0;
     font-size: 0.85rem;
 }

 .tag-actions {
     display: flex;
     width: 100%;
     gap: var(--space-3);
     justify-content: stretch;
     border-top: 1px solid color-mix(in srgb, var(--border-primary) 20%, transparent);
     padding-top: var(--space-3);
 }

 .btn-action {
     flex: 1;
     height: 48px;
     width: auto;
 }

 .pagination {
     gap: var(--space-4);
     padding: var(--space-4) 0;
 }

 .modal-footer {
     flex-direction: column-reverse;
     padding: var(--space-4);
     gap: var(--space-4);
 }

 .btn-finalize {
     width: 100%;
     font-size: 1rem;
     padding: var(--space-3-5);
 }
}

/* =========================================================================
   Alerts panel (Broadcast + Changelog)
   =========================================================================

   This panel used to be written entirely in Tailwind-style utilities —
   `px-4 py-3 text-sm bg-gray-900 flex-1` and so on. The ACP has no Tailwind
   build, so none of those classes existed: the panel was relying on a handful
   of inline `style=` attributes for anything that actually rendered, and the
   rest was inert. Hence the semantic classes here.
   ========================================================================= */

.alerts-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    height: 100%;
}

.alerts-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}

/* The compose form keeps its natural height; the changelog takes the rest and
   scrolls internally, so the page itself never scrolls. */
.alerts-compose {
    flex: none;
}

.alerts-changelog {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.alerts-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    gap: var(--space-4);
}

.alerts-card-title {
    margin: 0 0 var(--space-4) 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.alerts-card-header .alerts-card-title {
    margin-bottom: 0;
}

/* ── Compose form ─────────────────────────────────────────────────────── */

.alerts-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.alerts-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
}

.alerts-field-grow {
    flex: 1;
}

.alerts-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.alerts-input {
    width: 100%;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.alerts-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Markdown is written here, so a monospace column that can be dragged taller
   is the point rather than a preference. */
.alerts-textarea {
    min-height: 300px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
}

.alerts-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding-top: var(--space-2);
}

.alerts-status {
    font-weight: 500;
    font-size: 0.9rem;
}

.alerts-status.error {
    color: var(--danger-color);
}

.alerts-status.success {
    color: var(--success-color);
}

/* Editing a sent broadcast: the composer is outlined so it is obvious the
   send button now saves a correction rather than sending a new notice. */
.alerts-compose.editing {
    outline: 1px solid rgba(251, 191, 36, 0.55);
    outline-offset: 2px;
}
.alerts-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}
/* ── Push Engagement ──────────────────────────────────────────────────── */

/* Natural height like the composer; the changelog below keeps a floor so the
   extra card cannot squeeze it shut. */
.push-engagement {
    flex: none;
}
.alerts-changelog {
    min-height: 20rem;
}
.push-engagement-tables {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.push-engagement-subtitle {
    margin: var(--space-2) 0 0 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.push-engagement-table td {
    padding: var(--space-2) var(--space-4);
}
.push-engagement-table .push-engagement-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.push-engagement-category th {
    padding: var(--space-3) var(--space-4) var(--space-1);
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-primary);
}
.push-engagement-raw {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.push-engagement .empty-state .btn {
    margin-top: var(--space-3);
}

.broadcasts-table tr.expired-row td { opacity: 0.55; }
.broadcasts-table .row-actions { display: flex; gap: var(--space-1-5); flex-wrap: wrap; }
.btn.btn-sm { padding: var(--space-1) var(--space-2-5); font-size: 0.75rem; }
.btn.danger {
    background: color-mix(in srgb, var(--danger-color) 12%, transparent);
    color: color-mix(in srgb, var(--danger-color) 50%, var(--text-color));
    border: 1px solid color-mix(in srgb, var(--danger-color) 35%, transparent);
}

/* ── Changelog table ──────────────────────────────────────────────────── */

.changelog-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: var(--space-2);
}

/* Sticky header so the columns stay readable while scrolling a long history.
   Needs its own background or rows show through it. */
.changelog-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-tertiary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.changelog-table td {
    vertical-align: top;
}

.changelog-message-col {
    width: 50%;
}

.changelog-date {
    white-space: nowrap;
    color: var(--text-muted);
}

.changelog-commit {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.changelog-author {
    color: var(--text-secondary);
}

.changelog-message-title {
    font-weight: 500;
    color: var(--text-primary);
}

/* Commit bodies are pre-wrapped text and must keep their line breaks. */
.changelog-message-body {
    margin-top: var(--space-1);
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* The ACP's panel dialogs (`.modal-overlay.admin-overlay`). One step under the
   dialog layer, so a BaseModal confirm opened from one still covers it; they
   used to carry an inline `z-index: 2000` each. */
.modal-overlay.admin-overlay {
    z-index: calc(var(--z-modal) - 1);
}

/* CardAutocomplete's suggestion list (`components/card_autocomplete.rs`). */
.acp-autocomplete-list {
    position: absolute;
    z-index: var(--z-dropdown);
    width: 100%;
    margin-top: var(--space-0-5);
    max-height: 280px;
    overflow-y: auto;
    background: var(--popup-bg);
    border: 1px solid var(--popup-border);
    border-radius: var(--radius-md);
    /* `--popup-shadow` is a color; the inline style this replaced used it as the
       whole shadow, which is invalid and drew none. */
    box-shadow: 0 8px 24px var(--popup-shadow);
}
.admin-form-modal .base-modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.base-modal .user-item {
    width: 100%;
    text-align: left;
    border-radius: 0;
    background: transparent;
    min-height: 40px;
}

button.metric-card {
    width: 100%;
    font: inherit;
    color: inherit;
}

@media (prefers-reduced-motion: reduce) {
    .metric-card, .metric-card:hover { transform: none; transition: none; }
}

/* The line under a section heading that says how its numbers are measured. Used across the
   Growth, Jobs, Ops and Games tabs; it had no rule, so it rendered as body text. */
.admin-section-subtitle {
    margin: 0 0 var(--space-3);
    max-width: 72ch;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
