/* Telegram Cloud WebApp Styles */

:root {
    --tg-theme-bg-color: #ffffff;
    --tg-theme-text-color: #000000;
    --tg-theme-hint-color: #707579;
    --tg-theme-link-color: #3390ec;
    --tg-theme-button-color: #3390ec;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #f4f4f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    padding: 16px;
    line-height: 1.5;
}

body.overlay-open {
    overflow: hidden;
}

#app-root {
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

#app-header {
    margin-bottom: 16px;
}

#app-content {
    min-height: 60vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color);
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
button {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    border: none;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    gap: 8px;
}

button:hover {
    opacity: 0.8;
}

button:active {
    opacity: 0.6;
}

button.secondary {
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
}

button.icon-btn {
    background: none;
    color: var(--tg-theme-text-color);
    padding: 10px;
    font-size: 20px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 999px;
}

/* Search Bar */
.search-bar {
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    background: var(--tg-theme-bg-color);
    padding: 8px 0;
    z-index: 10;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--tg-theme-secondary-bg-color);
    border-radius: 12px;
    font-size: 14px;
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--tg-theme-button-color);
    background: var(--tg-theme-bg-color);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Navigation */
.nav-tabs,
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
    border: none;
    font: inherit;
    color: inherit;
}

.nav-tab.active {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

.nav-tab:hover {
    opacity: 0.8;
}

.nav-tab:focus-visible {
    outline: 2px solid var(--tg-theme-button-color);
    outline-offset: 2px;
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#file-list .file-list-placeholder {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-card {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: var(--tg-theme-secondary-bg-color);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--tg-theme-bg-color);
}

.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.skeleton-line {
    height: 10px;
    border-radius: 999px;
    background: var(--tg-theme-bg-color);
    width: 80%;
}

.skeleton-line.short {
    width: 50%;
}

.skeleton-stack {
    padding: 8px 0 24px;
}

.skeleton-shimmer {
    position: relative;
    overflow: hidden;
}

.skeleton-shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: translateX(-100%);
    animation: skeleton-shine 1.4s infinite;
}

@keyframes skeleton-shine {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(100%);
    }
}

#file-scroll-sentinel {
    width: 100%;
    height: 1px;
}

.file-card {
    display: flex;
    align-items: center;
    min-height: 72px;
    padding: 16px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 12px;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.file-card:active {
    transform: scale(0.98);
}

.file-card.selected {
    outline: 2px solid var(--tg-theme-link-color);
    outline-offset: 0;
}

.file-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.file-cover {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--tg-theme-secondary-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.file-cover .file-icon {
    font-size: 34px;
}

.file-cover__chip {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}

.file-cover--image {
    background: linear-gradient(145deg, #ffe5f2, #ffeec7);
}

.file-cover--video {
    background: linear-gradient(145deg, #d7f0ff, #ffd2f4);
}

.file-cover--audio {
    background: linear-gradient(145deg, #e0e7ff, #f5f0ff);
}

.file-cover--document {
    background: var(--tg-theme-secondary-bg-color);
}

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

.file-info h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-info p {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.file-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.file-actions .icon-btn {
    background: transparent;
    color: var(--tg-theme-text-color);
    transition: background 0.2s;
}

.file-actions .icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.kebab-menu {
    font-size: 24px !important;
    font-weight: bold;
    line-height: 1;
    color: var(--tg-theme-hint-color) !important;
}

.kebab-menu:hover {
    color: var(--tg-theme-text-color) !important;
}

.file-actions button {
    background: transparent;
    border: none;
    color: var(--tg-theme-text-color);
}

/* Folder View */
.folder-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.folder-card {
    padding: 18px 16px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 12px;
    min-height: 120px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.folder-card:active {
    transform: scale(0.95);
}

.folder-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.folder-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--tg-theme-hint-color);
}

.empty-state.subtle {
    border: 1px solid var(--tg-theme-secondary-bg-color);
    border-radius: 12px;
    color: var(--tg-theme-text-color);
}

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

.empty-state h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--tg-theme-hint-color);
}

/* Error */
.error {
    padding: 16px;
    background: #ffe5e5;
    color: #d00;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.modal-content {
    background: var(--tg-theme-bg-color);
    border-radius: 12px;
    padding: 0;
    max-width: 400px;
    width: 100%;
    position: relative;
    z-index: 2;
    animation: slideUp 0.2s ease;
}

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

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--tg-theme-hint-color);
}

.modal-body {
    padding: 20px;
}

.modal-input,
.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    box-sizing: border-box;
}

.modal-input:focus,
.modal-content input:focus {
    outline: none;
    border-color: var(--tg-theme-button-color);
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.modal-actions button {
    flex: 1;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--tg-theme-bg-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    min-width: 200px;
    z-index: 1001;
    animation: fadeIn 0.15s ease;
}

.context-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.context-menu-item:hover {
    background: var(--tg-theme-secondary-bg-color);
}

.context-menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.context-menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* Folder Select List */
.folder-select-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.folder-select-item {
    padding: 12px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.folder-select-item:hover {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

.folder-select-item:active {
    transform: scale(0.98);
}

.empty-state-small {
    text-align: center;
    padding: 20px;
    color: var(--tg-theme-hint-color);
}

.empty-state-small p {
    margin-bottom: 12px;
}

/* Bottom Bar (for multi-select) */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--tg-theme-bg-color);
    border-top: 1px solid var(--tg-theme-secondary-bg-color);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.bottom-bar-info {
    font-size: 14px;
    font-weight: 500;
}

.bottom-bar-actions {
    display: flex;
    gap: 8px;
}

.bottom-bar-actions button {
    padding: 8px 16px;
    font-size: 14px;
}

button.danger {
    background: #dc3545;
    color: white;
}

button.danger:hover {
    background: #c82333;
}

/* File Checkbox */
.file-checkbox {
    font-size: 24px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
}

.file-card.selection-mode {
    cursor: pointer;
}
.file-card.selection-mode.selected .file-cover {
    box-shadow: 0 0 0 2px var(--tg-theme-link-color);
}

/* Active selection button */
button.active {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

/* Share Modal */
.share-link {
    padding: 12px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    font-size: 14px;
    word-break: break-all;
    margin: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.share-lead {
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--tg-theme-text-color);
}

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.copy-button {
    width: 100%;
    margin-top: 8px;
}

.share-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

.share-action-btn.secondary {
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
}

.share-hint {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    margin-top: 12px;
}

.selection-hint {
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--tg-theme-secondary-bg-color);
    border-left: 4px solid var(--tg-theme-link-color);
    color: var(--tg-theme-text-color);
    display: none;
    gap: 8px;
}

.selection-hint strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.selection-hint p {
    margin: 0;
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.web-login {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.web-login.hidden {
    display: none;
}

.web-login-card {
    max-width: 420px;
    width: 90%;
    padding: 24px;
    border-radius: 16px;
    background: var(--tg-theme-secondary-bg-color, #1f1f29);
    color: var(--tg-theme-text-color, #fff);
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.web-login-card h1 {
    margin-top: 0;
}

.web-login-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

.web-login .cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--tg-theme-button-color, #2ea1ff);
    color: var(--tg-theme-button-text-color, #fff);
    text-decoration: none;
    font-weight: 600;
}

/* File Detail */
.file-detail {
    padding: 20px;
}

.file-detail-header {
    text-align: center;
    margin-bottom: 24px;
}

.file-detail-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.file-detail-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.file-detail-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
}

.info-label {
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
}

.file-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Responsive */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .folder-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}


/* Media overlay */
.media-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.media-overlay-surface {
    position: relative;
    width: min(640px, 92vw);
    max-height: 90vh;
    background: var(--tg-theme-bg-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.media-overlay-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.media-overlay-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.media-overlay-button {
    border: none;
    border-radius: 999px;
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-width: 44px;
}

.media-overlay-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    touch-action: manipulation;
}

.media-overlay.image-viewer .media-overlay-surface {
    width: 100%;
    max-width: none;
    height: 100%;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.media-overlay.image-viewer .media-overlay-content {
    height: 100%;
    padding: 20px;
    justify-content: center;
}

.image-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    position: relative;
}

.image-stage img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    transition: transform 0.2s ease-out;
    cursor: grab;
}

.image-counter {
    position: absolute;
    top: 24px;
    left: 24px;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.image-caption {
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    padding: 6px 12px;
    border-radius: 999px;
    align-self: center;
    max-width: 90vw;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.45);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-nav.prev {
    left: 16px;
}

.image-nav.next {
    right: 16px;
}

.image-nav.hidden {
    display: none;
}

.media-overlay.video-viewer video,
.media-overlay.audio-viewer audio {
    width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    background: #000;
}

.document-frame {
    width: 100%;
    height: 60vh;
    border: none;
    border-radius: 12px;
    background: #fff;
}

.pdf-viewer-frame {
    height: 72vh;
    background: #000;
}

.document-meta {
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

.document-preview-header h2 {
    font-size: 20px;
}

.document-download {
    padding: 16px;
    border-radius: 12px;
    background: var(--tg-theme-secondary-bg-color);
}

.document-actions {
    display: flex;
    justify-content: center;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
}

@media (max-width: 480px) {
    .media-overlay-surface {
        width: 94vw;
        padding: 16px;
    }

    .image-stage img {
        max-height: 60vh;
    }

    .media-gallery {
        max-height: none;
        padding: 0;
    }

    .media-card {
        border-radius: 16px;
    }

    .media-card__aspect {
        border-radius: 14px;
    }
}

/* Media gallery */
.media-panel {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.media-panel__header h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.media-panel__header p {
    color: var(--tg-theme-hint-color);
    font-size: 13px;
}

.media-gallery-empty {
    display: none;
    padding: 12px;
    border-radius: 12px;
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

.media-gallery {
    position: relative;
    width: 100%;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 16px;
    background: color-mix(in srgb, var(--tg-theme-secondary-bg-color) 70%, transparent);
    padding: 8px;
    scroll-behavior: smooth;
}

.media-gallery__inner {
    position: relative;
}

.media-card {
    width: 100%;
    background: var(--tg-theme-bg-color);
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    outline: none;
}

.media-card:focus-visible {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tg-theme-button-color) 40%, transparent);
}

.media-card__aspect {
    position: relative;
    width: 100%;
    padding-top: calc(100% / clamp(var(--media-card-ratio, 1), 0.6, 1.6));
    border-radius: 16px;
    overflow: hidden;
    background-image: var(--media-card-lqip, linear-gradient(120deg, #d9d9d9, #f0f0f0));
    background-size: cover;
}

.media-card__skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, rgba(0,0,0,0.05) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.05) 75%);
    animation: shimmer 1.2s infinite;
}

.media-card__asset {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.media-card__asset--visible {
    opacity: 1;
}

.media-card__details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.media-card__title {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-card__meta {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.media-card--video .media-card__asset {
    object-fit: cover;
}

.media-card--error {
    border: 1px solid rgba(255, 0, 0, 0.2);
}

@keyframes shimmer {
    0% {
        background-position: -100px 0;
    }
    100% {
        background-position: 100px 0;
    }
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    min-width: 240px;
    max-width: 90vw;
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 14px;
    text-align: center;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--success {
    background: rgba(24, 163, 85, 0.95);
}

.toast--error {
    background: rgba(210, 60, 60, 0.95);
}
