/* ============================================================
   Assets Page — Modern Glass
   ============================================================ */

.assets-main {
    padding: 2rem 0;
    min-height: calc(100vh - 70px);
}

.assets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-sm);
}

.assets-header h2 {
    margin: 0 0 0.15rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.assets-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.assets-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Stats Bar */
.assets-stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0 1rem;
    border-right: 1px solid var(--gray-100);
}

.stat-item:last-child {
    border-right: none;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.stat-value.stat-active {
    color: var(--success);
}

.stat-value.stat-inactive {
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Search & Filter Bar */
.assets-search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.assets-search-bar .form-control {
    flex: 1;
    min-width: 140px;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
}

.assets-search-bar input[type="text"] {
    flex: 2;
    min-width: 200px;
}

/* Bulk Action Bar */
.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    background: var(--primary-glow);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    animation: fadeIn var(--duration-normal) var(--ease-out);
}

.bulk-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-danger {
    padding: 0.375rem 1rem;
    font-size: 0.85rem;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all var(--duration-fast);
}

.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    padding: 0.15rem;
}

.view-toggle-btn {
    padding: 0.35rem 0.6rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all var(--duration-fast);
    font-family: inherit;
    line-height: 1;
}

.view-toggle-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Grid */
.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

/* Card */
.asset-card {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all var(--duration-normal) var(--ease-out);
}

.asset-card:hover {
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(99, 102, 241, 0.08);
    transform: translateY(-3px);
    border-color: rgba(99, 102, 241, 0.15);
}

.asset-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-glow), var(--shadow-sm);
}

/* Checkbox on card */
.asset-select-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2;
}

.asset-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Preview */
.asset-preview {
    position: relative;
    width: 100%;
    height: 180px;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

.asset-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-slow) var(--ease-out);
}

.asset-card:hover .asset-thumb {
    transform: scale(1.03);
}

.asset-icon-placeholder {
    font-size: 3.5rem;
    color: var(--gray-300);
}

/* Preview hover overlay */
.asset-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--duration-normal);
}

.asset-card:hover .asset-preview-overlay {
    opacity: 1;
}

.asset-preview-overlay-icon {
    color: white;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Badge */
.asset-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.15rem 0.55rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Extension badge for list mode */
.asset-ext-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: var(--primary-glow);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Folder chip */
.asset-folder-chip {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: var(--gray-100);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.68rem;
    font-weight: 500;
}

/* Body */
.asset-body {
    padding: 0.75rem 1rem;
    flex: 1;
}

.asset-name {
    margin: 0 0 0.3rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--gray-400);
    align-items: center;
    flex-wrap: wrap;
}

/* Footer with icon buttons */
.asset-footer {
    padding: 0.6rem 0.85rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

.asset-footer .btn-icon {
    font-size: 0.85rem;
    padding: 0.35rem 0.45rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.asset-footer .btn-icon:hover {
    background: var(--primary-glow);
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.asset-footer .btn-icon.danger:hover {
    background: var(--error-light);
    color: var(--error);
    border-color: var(--error);
}

/* ============================================================
   List View
   ============================================================ */

.assets-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.asset-card-list {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-normal) var(--ease-out);
}

.asset-card-list:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(99, 102, 241, 0.1);
}

.asset-card-list.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.asset-thumb-sm-wrap {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
}

.asset-thumb-sm {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.asset-list-body {
    flex: 1;
    min-width: 0;
}

.asset-list-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.2rem;
}

.asset-list-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-400);
    align-items: center;
    flex-wrap: wrap;
}

.asset-list-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.asset-list-actions .btn-icon {
    font-size: 0.85rem;
    padding: 0.35rem 0.45rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.asset-list-actions .btn-icon:hover {
    background: var(--primary-glow);
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.asset-list-actions .btn-icon.danger:hover {
    background: var(--error-light);
    color: var(--error);
    border-color: var(--error);
}

/* ============================================================
   Upload Queue
   ============================================================ */

.upload-queue {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.upload-queue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.upload-queue-item:last-child {
    border-bottom: none;
}

.upload-queue-item-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.upload-queue-item-size {
    font-size: 0.78rem;
    color: var(--gray-400);
    white-space: nowrap;
}

.upload-queue-item-progress {
    width: 80px;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.upload-queue-item-progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 2px;
    transition: width var(--duration-fast);
}

.upload-queue-item-status {
    font-size: 0.75rem;
    font-weight: 600;
    width: 50px;
    text-align: right;
    color: var(--text-secondary);
}

.upload-queue-item-status.done {
    color: var(--success);
}

.upload-queue-item-status.error {
    color: var(--error);
}

/* Upload progress (legacy single) */
.upload-progress-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-gradient);
    border-radius: 3px;
    transition: width var(--duration-fast);
}

.upload-progress-text {
    text-align: center;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ============================================================
   Drag & Drop Overlay
   ============================================================ */

.assets-drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(99, 102, 241, 0.08);
    border: 3px dashed var(--primary-color);
    z-index: 900;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.assets-drop-overlay.active {
    display: flex;
}

.assets-drop-overlay-content {
    text-align: center;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 600;
}

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast);
    z-index: 2;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast);
    z-index: 2;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

.lightbox-info {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    white-space: nowrap;
}

/* ============================================================
   Asset Details Modal
   ============================================================ */

.modal-lg {
    max-width: 750px;
}

.asset-details-layout {
    display: flex;
    gap: 1.5rem;
}

.asset-details-preview {
    flex-shrink: 0;
    width: 280px;
}

.asset-details-preview img,
.asset-details-preview video {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    cursor: pointer;
}

.asset-details-info {
    flex: 1;
    min-width: 0;
}

.asset-details-meta {
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.asset-details-meta strong {
    color: var(--text-primary);
}

.input-with-action {
    display: flex;
    gap: 0.5rem;
}

.input-with-action .form-control {
    flex: 1;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-sm);
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.empty-state h3 {
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.empty-state p {
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
}

.empty-filter-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    grid-column: 1 / -1;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: scaleIn var(--duration-normal) var(--ease-spring);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: var(--gray-100);
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all var(--duration-fast);
    line-height: 1;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.925rem;
    font-family: inherit;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.8);
    transition: all var(--duration-normal) var(--ease-out);
    outline: none;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: white;
}

.form-help-text {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--gray-400);
}

.error-message {
    background: var(--error-light);
    color: #B91C1C;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--error);
}

.success-message {
    background: var(--success-light);
    color: #065F46;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--success);
}

.btn-sm {
    padding: 0.375rem 1rem;
    font-size: 0.85rem;
}

/* ============================================================
   Responsive — Tablet
   ============================================================ */
@media (max-width: 1024px) {
    .assets-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    .asset-details-layout {
        flex-direction: column;
    }

    .asset-details-preview {
        width: 100%;
    }
}

/* ============================================================
   Responsive — Phone
   ============================================================ */
@media (max-width: 768px) {
    .assets-main {
        padding: 1rem 0;
    }

    .assets-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .assets-header h2 {
        font-size: 1.2rem;
    }

    .assets-actions {
        justify-content: space-between;
    }

    .assets-actions .btn-primary {
        flex: 1;
        text-align: center;
    }

    .assets-stats-bar {
        gap: 0.5rem;
        padding: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .stat-item {
        padding: 0 0.5rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .assets-search-bar {
        flex-direction: column;
    }

    .assets-search-bar .form-control {
        min-width: unset;
    }

    .assets-search-bar input[type="text"] {
        min-width: unset;
    }

    .bulk-action-bar {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .bulk-actions {
        justify-content: center;
    }

    .assets-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .asset-preview {
        height: 130px;
    }

    .asset-body {
        padding: 0.5rem 0.65rem;
    }

    .asset-name {
        font-size: 0.85rem;
    }

    .asset-meta {
        font-size: 0.7rem;
    }

    .asset-footer {
        flex-wrap: wrap;
    }

    .asset-card-list {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .asset-list-actions {
        flex-wrap: wrap;
    }

    .modal-content {
        max-width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .modal {
        align-items: flex-end;
    }

    .lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }

    .lightbox-close {
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }

    .empty-state {
        padding: 2rem 1rem;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .assets-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .asset-preview {
        height: 100px;
    }

    .asset-footer {
        justify-content: center;
    }
}
