@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --text-color: #333333;
    --hover-bg: rgba(255, 255, 255, 0.95);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

header {
    margin-bottom: 2rem;
    text-align: center;
    animation: fadeInDown 0.8s ease;
}

h1 {
    font-weight: 600;
    font-size: 2.5rem;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(255,255,255,0.8);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    animation: fadeIn 1s ease;
    min-height: 400px;
    position: relative;
}

.breadcrumb {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.6);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    overflow-x: auto;
    white-space: nowrap;
}

.breadcrumb span.crumb {
    cursor: pointer;
    transition: color 0.3s;
    font-weight: 500;
}

.breadcrumb span.crumb:hover {
    color: #007bff;
}

.breadcrumb span.separator {
    margin: 0 0.5rem;
    opacity: 0.7;
}

.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.file-item {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.file-item:hover {
    background: var(--hover-bg);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.file-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    object-fit: contain;
}

.file-name {
    font-size: 0.95rem;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1.2rem;
}

.error-message {
    text-align: center;
    color: #d32f2f;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

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

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

@media (max-width: 768px) {
    #app {
        padding: 1rem;
    }
    .glass-panel {
        padding: 1.5rem;
    }
    .file-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
}

/* --- In-page video viewer --- */
body.viewer-open {
    overflow: hidden;
}

.viewer-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
}

.viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.viewer-dialog {
    position: relative;
    width: min(100%, 980px);
    max-height: 92vh;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.viewer-title {
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.viewer-close {
    border: none;
    background: rgba(0, 0, 0, 0.08);
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.viewer-body {
    padding: 1rem;
    background: #111;
}

.viewer-iframe {
    display: block;
    width: 100%;
    height: min(74vh, 720px);
    background: #000;
    border: 0;
    border-radius: 10px;
}

.viewer-video {
    display: block;
    width: 100%;
    max-height: 74vh;
    background: #000;
    border-radius: 10px;
}

.viewer-message {
    color: #fff;
    text-align: center;
    padding: 3rem 1rem;
    line-height: 1.8;
}

@media (max-width: 768px) {
    .viewer-modal {
        padding: 0;
        align-items: stretch;
    }

    .viewer-dialog {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .viewer-body {
        flex: 1;
        display: flex;
        align-items: center;
        padding: 0.5rem;
    }

    .viewer-iframe {
        height: calc(100vh - 4.5rem);
        border-radius: 0;
    }

    .viewer-video {
        max-height: calc(100vh - 4.5rem);
    }
}
