/* ============================================================
   assets.css — Module 23: Asset Library
   CSS namespace: ast-*
   ============================================================ */

/* ── Layout ──────────────────────────────────────────────────────────────── */

.ast-layout {
    max-width: 1300px;
    margin: 24px auto 0;
    padding: 0 1.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Top bar (search + type pills + upload button) ────────────────────────── */

.ast-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ast-search {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    height: 38px;
    padding: 0 14px;
    background: #1e2535;
    border: 1px solid #2d3748;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.ast-search:focus {
    border-color: #6366f1;
}

.ast-search::placeholder {
    color: #4a5568;
}

.ast-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.ast-pill {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #2d3748;
    background: #1e2535;
    color: #94a3b8;
    transition: all 0.15s;
    white-space: nowrap;
}

.ast-pill:hover {
    border-color: #6366f1;
    color: #a5b4fc;
}

.ast-pill--active {
    background: #312e81;
    border-color: #6366f1;
    color: #c7d2fe;
}

.ast-upload-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.ast-upload-btn:hover:not(:disabled) {
    background: #4f46e5;
}

.ast-upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ast-upload-btn .material-symbols-outlined {
    font-size: 18px;
}

/* ── Upload panel ─────────────────────────────────────────────────────────── */

.ast-upload-panel {
    background: #141928;
    border: 1px solid #2d3748;
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ast-upload-panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
}

.ast-dropzone {
    border: 2px dashed #2d3748;
    border-radius: 10px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #0f1523;
    text-align: center;
}

.ast-dropzone:hover,
.ast-dropzone--drag {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

.ast-dropzone-icon {
    font-size: 2.5rem;
    color: #4a5568;
}

.ast-dropzone-hint {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

.ast-dropzone-hint span {
    color: #818cf8;
    font-weight: 500;
}

.ast-dropzone-limit {
    font-size: 0.78rem;
    color: #4a5568;
}

/* Hidden file input */
.ast-file-input {
    display: none;
}

/* Upload meta fields */
.ast-upload-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.ast-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ast-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ast-select {
    height: 38px;
    padding: 0 12px;
    background: #1e2535;
    border: 1px solid #2d3748;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
}

.ast-select:focus {
    border-color: #6366f1;
}

.ast-tags-input {
    height: 38px;
    padding: 0 12px;
    background: #1e2535;
    border: 1px solid #2d3748;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.ast-tags-input:focus {
    border-color: #6366f1;
}

.ast-tags-input::placeholder {
    color: #4a5568;
}

.ast-public-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.ast-public-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #6366f1;
    cursor: pointer;
    flex-shrink: 0;
}

.ast-public-toggle-label {
    font-size: 0.875rem;
    color: #94a3b8;
    cursor: pointer;
}

/* Selected file preview strip */
.ast-selected-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
}

.ast-selected-file-icon {
    font-size: 1.4rem;
    color: #818cf8;
}

.ast-selected-file-name {
    flex: 1;
    font-size: 0.875rem;
    color: #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ast-selected-file-size {
    font-size: 0.78rem;
    color: #64748b;
    white-space: nowrap;
}

.ast-selected-file-clear {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.ast-selected-file-clear:hover {
    color: #f87171;
}

.ast-selected-file-clear .material-symbols-outlined {
    font-size: 16px;
}

/* Upload action row */
.ast-upload-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ast-upload-submit {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 22px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ast-upload-submit:hover:not(:disabled) {
    background: #4f46e5;
}

.ast-upload-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ast-upload-submit .material-symbols-outlined {
    font-size: 18px;
}

.ast-cancel-btn {
    padding: 9px 18px;
    background: transparent;
    border: 1px solid #2d3748;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s;
}

.ast-cancel-btn:hover {
    border-color: #4a5568;
    color: #e2e8f0;
}

/* Error banner inside panel */
.ast-error {
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    font-size: 0.875rem;
    color: #fca5a5;
}

/* ── Stats bar ────────────────────────────────────────────────────────────── */

.ast-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.ast-stat {
    background: #141928;
    border: 1px solid #2d3748;
    border-radius: 10px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 130px;
}

.ast-stat-icon {
    font-size: 1.3rem;
    color: #6366f1;
}

.ast-stat-body {}

.ast-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.2;
}

.ast-stat-label {
    font-size: 0.75rem;
    color: #64748b;
}

/* ── Grid ─────────────────────────────────────────────────────────────────── */

.ast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.2rem;
}

/* ── Asset card ───────────────────────────────────────────────────────────── */

.ast-card {
    background: #141928;
    border: 1px solid #2d3748;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
}

.ast-card:hover {
    border-color: #4a5568;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Thumbnail area */
.ast-card-thumb {
    height: 150px;
    background: #0f1523;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.ast-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ast-card-thumb-icon {
    font-size: 3rem;
    color: #2d3748;
}

/* Overlay actions on hover */
.ast-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.ast-card:hover .ast-card-overlay {
    opacity: 1;
}

.ast-overlay-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(30, 37, 53, 0.9);
    border: 1px solid #4a5568;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.ast-overlay-btn:hover {
    background: #1e2535;
    border-color: #6366f1;
    color: #818cf8;
}

.ast-overlay-btn--delete:hover {
    border-color: #ef4444;
    color: #f87171;
}

.ast-overlay-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Card body */
.ast-card-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ast-card-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ast-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ast-card-size {
    font-size: 0.75rem;
    color: #64748b;
}

.ast-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ast-type-badge--image   { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.ast-type-badge--font    { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
.ast-type-badge--video   { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.ast-type-badge--document{ background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.ast-type-badge--other   { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }

.ast-public-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
}

.ast-public-badge .material-symbols-outlined {
    font-size: 11px;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

.ast-empty {
    text-align: center;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.ast-empty-icon {
    font-size: 4rem;
    color: #2d3748;
}

.ast-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a5568;
    margin: 0;
}

.ast-empty-desc {
    font-size: 0.875rem;
    color: #374151;
    margin: 0;
}

.ast-empty-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.ast-empty-btn:hover {
    background: #4f46e5;
}

.ast-empty-btn .material-symbols-outlined {
    font-size: 18px;
}

/* ── Loading shimmer ──────────────────────────────────────────────────────── */

@keyframes ast-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.ast-skeleton {
    background: linear-gradient(90deg, #1e2535 25%, #252d40 50%, #1e2535 75%);
    background-size: 600px 100%;
    animation: ast-shimmer 1.4s infinite;
    border-radius: 6px;
}

.ast-card-skeleton {
    background: #141928;
    border: 1px solid #2d3748;
    border-radius: 12px;
    overflow: hidden;
}

.ast-card-skeleton-thumb {
    height: 150px;
}

.ast-card-skeleton-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ast-card-skeleton-name {
    height: 14px;
    width: 75%;
}

.ast-card-skeleton-meta {
    height: 12px;
    width: 50%;
}

/* ── Pagination ───────────────────────────────────────────────────────────── */

.ast-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1rem;
}

.ast-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid #2d3748;
    background: #141928;
    color: #94a3b8;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ast-page-btn:hover:not(:disabled) {
    border-color: #6366f1;
    color: #c7d2fe;
}

.ast-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ast-page-btn--active {
    background: #312e81;
    border-color: #6366f1;
    color: #c7d2fe;
    font-weight: 600;
}

.ast-page-info {
    font-size: 0.8rem;
    color: #4a5568;
    padding: 0 8px;
}

/* ── Detail drawer ────────────────────────────────────────────────────────── */

.ast-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 200;
    display: flex;
    justify-content: flex-end;
}

.ast-drawer {
    width: 400px;
    max-width: 95vw;
    height: 100%;
    background: #141928;
    border-left: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ast-drawer-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #1e2535;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ast-drawer-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ast-drawer-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    transition: color 0.15s;
}

.ast-drawer-close:hover {
    color: #e2e8f0;
}

.ast-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

/* Preview panel inside drawer */
.ast-drawer-preview {
    height: 200px;
    background: #0f1523;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ast-drawer-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ast-drawer-preview-icon {
    font-size: 4rem;
    color: #2d3748;
}

/* Meta rows */
.ast-meta-table {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px 16px;
    font-size: 0.875rem;
}

.ast-meta-key {
    color: #64748b;
    font-weight: 500;
}

.ast-meta-val {
    color: #e2e8f0;
    word-break: break-all;
}

/* URL copy row */
.ast-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ast-url-text {
    flex: 1;
    font-size: 0.78rem;
    color: #64748b;
    background: #0f1523;
    border: 1px solid #1e2535;
    border-radius: 6px;
    padding: 6px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ast-copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #1e2535;
    border: 1px solid #2d3748;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.ast-copy-btn:hover {
    border-color: #6366f1;
    color: #818cf8;
}

.ast-copy-btn .material-symbols-outlined {
    font-size: 15px;
}

/* Drawer delete */
.ast-drawer-delete {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #f87171;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
    justify-content: center;
    margin-top: auto;
}

.ast-drawer-delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

.ast-drawer-delete .material-symbols-outlined {
    font-size: 18px;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */

.ast-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: ast-toast-in 0.2s ease-out;
}

@keyframes ast-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ast-toast--success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

.ast-toast--error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* ── Loading overlay (full-page for upload) ───────────────────────────────── */

.ast-loading-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #64748b;
}

/* Shared spinner (reused from other pages) */
.ast-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #2d3748;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: ast-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes ast-spin {
    to { transform: rotate(360deg); }
}

/* ── Global error banner ─────────────────────────────────────────────────── */

.ast-page-error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: #fca5a5;
}

.ast-page-error .material-symbols-outlined {
    font-size: 20px;
    flex-shrink: 0;
}

.ast-page-error-retry {
    margin-left: auto;
    padding: 6px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #f87171;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.ast-page-error-retry:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ── Delete blocker modal (asset in use) ─────────────────────────────────── */

.ast-usage-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    z-index: 420;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ast-usage-modal {
    width: min(680px, 96vw);
    max-height: 86vh;
    background: #141928;
    border: 1px solid #2d3748;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ast-usage-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid #1e2535;
}

.ast-usage-header .material-symbols-outlined {
    color: #f59e0b;
    font-size: 1.3rem;
    margin-top: 2px;
}

.ast-usage-title {
    margin: 0;
    color: #e2e8f0;
    font-size: 0.97rem;
    font-weight: 700;
}

.ast-usage-subtitle {
    margin: 2px 0 0;
    color: #94a3b8;
    font-size: 0.84rem;
}

.ast-usage-close {
    margin-left: auto;
    border: none;
    background: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 3px;
}

.ast-usage-close:hover {
    color: #e2e8f0;
}

.ast-usage-body {
    padding: 1rem 1.15rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.ast-usage-help {
    margin: 0;
    font-size: 0.84rem;
    color: #cbd5e1;
}

.ast-usage-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.ast-usage-item {
    display: grid;
    grid-template-columns: 20px 1fr 20px;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #cbd5e1;
    background: #101624;
    border: 1px solid #263248;
    border-radius: 8px;
    padding: 9px 10px;
}

.ast-usage-item:hover {
    border-color: #6366f1;
    color: #e2e8f0;
}

.ast-usage-item .material-symbols-outlined {
    font-size: 1rem;
    color: #818cf8;
}

.ast-usage-open {
    justify-self: end;
}

.ast-usage-footer {
    border-top: 1px solid #1e2535;
    padding: 0.85rem 1.15rem;
    display: flex;
    justify-content: flex-end;
}

.ast-usage-ok {
    border: 1px solid #334155;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.ast-usage-ok:hover {
    border-color: #6366f1;
}
