:root {
    --brand-blue: #1789ee;
    --brand-blue-soft: #eaf5ff;
    --text: #1e2b46;
    --muted: #7d899f;
    --border: #e8edf5;
    --surface: #fff;
    --page: #f8fbff;
    --shadow: 0 16px 45px rgba(37, 80, 123, 0.08);
}

* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background:
        radial-gradient(
            circle at 4% 20%,
            rgba(48, 191, 255, 0.06),
            transparent 18rem
        ),
        linear-gradient(180deg, #fff 0, #f8fcff 38%, #f7fbff 100%);
    color: var(--text);
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(28, 72, 117, 0.04);
}

.brand-logo {
    width: 112px;
    height: 50px;
    object-fit: contain;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffe380, #8ed9ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a3f79;
    font-weight: 900;
    letter-spacing: 0.4px;
}

.nav-link {
    color: #263956 !important;
    font-weight: 600;
    padding: 0.9rem 1rem !important;
    position: relative;
}
.nav-link.active {
    color: #2d8e2f !important;
}
.nav-link.active:after {
    content: "";
    position: absolute;
    left: 20%;
    right: 20%;
    bottom: 0.35rem;
    height: 2px;
    border-radius: 2px;
    background: #3bb43f;
}

.hero {
    padding: 44px 0 24px;
    position: relative;
    overflow: hidden;
}
.hero:after {
    content: "";
    position: absolute;
    right: 6%;
    top: 5px;
    width: 260px;
    height: 160px;
    background:
        radial-gradient(circle at 70% 45%, #d9f7ff 0 16%, transparent 17%),
        radial-gradient(circle at 45% 32%, #bfefff 0 12%, transparent 13%),
        radial-gradient(circle at 85% 68%, #9ce9d8 0 10%, transparent 11%);
    opacity: 0.65;
}
.hero-title {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 900;
    letter-spacing: -1px;
    line-height: 1;
}
.hero-title .c1 {
    color: #ff5246;
}
.hero-title .c2 {
    color: #ffb31c;
}
.hero-title .c3 {
    color: #43b55d;
}
.hero-title .c4 {
    color: #244d83;
}
.hero p {
    color: #53647d;
}

.gallery-shell {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
    min-height: 680px;
}

.sidebar {
    width: 310px;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #fbfdff);
}

.sidebar-title {
    font-weight: 800;
    color: var(--primary-color);
    font-size: 1.15rem;
}

.folder-tree .tree-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    color: #283751;
    font-weight: 600;
}
.folder-tree .tree-item:hover {
    background: #f3f8ff;
}
.folder-tree .tree-item.active {
    background: var(--brand-blue-soft);
    color: var(--primary-color);
}
.folder-tree .tree-item small {
    margin-left: auto;
    color: #6684aa;
    font-weight: 500;
}
.tree-children {
    margin-left: 1.2rem;
    border-left: 1px solid #dde6f1;
    padding-left: 0.65rem;
}

.storage-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    padding: 1.15rem;
    box-shadow: 0 8px 24px rgba(36, 73, 112, 0.05);
}

.content-pane {
    min-width: 0;
    flex: 1;
}
.content-toolbar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 5;
}

.crumb {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 800;
}

.search-box {
    width: min(100%, 340px);
    position: relative;
}
.search-box input {
    padding-right: 2.7rem;
    border-radius: 11px;
    border-color: #dfe7f1;
    height: 42px;
}
.search-box i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #7b8ba4;
}

.view-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    border: 1px solid #dfe7f1;
    background: #fff;
    color: #51647e;
}
.view-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.upload-btn {
    height: 42px;
    border-radius: 10px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(24, 137, 238, 0.18);
}

.content-body {
    padding: 1.1rem 1.25rem 1.6rem;
}
.section-label {
    font-weight: 800;
    font-size: 0.95rem;
    margin: 0.25rem 0 0.8rem;
}

.folder-card,
.file-card {
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #fff;
    overflow: hidden;
    height: 100%;
    transition: 0.2s ease;
}
.folder-card:hover,
.file-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(42, 75, 110, 0.1);
    border-color: #d7e5f3;
}
.folder-card {
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    position: relative;
}
.folder-menu,
.file-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: transparent;
    color: #45617f;
    z-index: 2;
}

.folder-visual {
    height: 110px;
    margin: 0 auto 0.55rem;
    width: 120px;
    position: relative;
}
.folder-shape {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 8px;
    height: 80px;
    border-radius: 12px 12px 16px 16px;
    background: linear-gradient(180deg, #ffd463, #f7b623);
    box-shadow: inset 0 -8px 0 rgba(255, 255, 255, 0.18);
}
.folder-shape:before {
    content: "";
    position: absolute;
    width: 55px;
    height: 20px;
    top: -15px;
    left: 10px;
    background: inherit;
    border-radius: 9px 9px 0 0;
}
.folder-shape.purple {
    background: linear-gradient(180deg, #b47bea, #8250c8);
}
.folder-shape.pink {
    background: linear-gradient(180deg, #ff79a7, #ea3f77);
}
.folder-shape.green {
    background: linear-gradient(180deg, #a6cf55, #6fae1f);
}
.folder-shape.red {
    background: linear-gradient(180deg, #ff8a7a, #ed5545);
}
.folder-emoji {
    position: absolute;
    inset: 21px 0 0;
    z-index: 2;
    font-size: 2.3rem;
    color: #fff;
}

.folder-card h6 {
    font-weight: 800;
    margin: 0;
}
.folder-card p {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0.2rem 0 0;
}

.file-thumb {
    height: 115px;
    background: #f3f6fa;
    position: relative;
    overflow: hidden;
}
.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.file-thumb .doc-icon {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 3.2rem;
    color: #bcc7d5;
}
.video-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    border-radius: 8px;
    background: rgba(20, 26, 36, 0.75);
    color: #fff;
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
}
.file-meta {
    padding: 0.65rem 0.8rem;
}
.file-name {
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-size {
    font-size: 0.74rem;
    color: var(--muted);
}

.list-mode .gallery-folder-col,
.list-mode .gallery-file-col {
    width: 100%;
}
.list-mode .folder-card,
.list-mode .file-card {
    display: flex;
    align-items: center;
    text-align: left;
    min-height: 88px;
    padding: 0.6rem 0.8rem;
}
.list-mode .folder-visual {
    width: 78px;
    height: 66px;
    margin: 0 0.9rem 0 0;
    flex: 0 0 78px;
}
.list-mode .folder-shape {
    height: 48px;
}
.list-mode .folder-shape:before {
    height: 13px;
    top: -9px;
    width: 36px;
}
.list-mode .folder-emoji {
    font-size: 1.45rem;
    inset: 20px 0 0;
}
.list-mode .file-thumb {
    width: 110px;
    height: 72px;
    flex: 0 0 110px;
    border-radius: 10px;
}
.list-mode .file-meta {
    flex: 1;
}

.mobile-sidebar-toggle {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -330px;
        top: 0;
        bottom: 0;
        z-index: 1060;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.12);
        transition: 0.25s;
        overflow: auto;
    }
    .sidebar.open {
        left: 0;
    }
    .mobile-sidebar-toggle {
        display: inline-flex;
    }
    .gallery-shell {
        min-height: 620px;
    }
    .hero {
        padding-top: 28px;
    }
}

@media (max-width: 575.98px) {
    .content-toolbar {
        padding: 0.85rem;
    }
    .content-body {
        padding: 0.9rem;
    }
    .upload-btn span {
        display: none;
    }
    .hero-title {
        font-size: 2.15rem;
    }
}

.gallery-image-preview {
    cursor: pointer;
}

.gallery-image-preview img {
    transition: transform 0.25s ease;
}

.gallery-image-preview:hover img {
    transform: scale(1.04);
}

.gallery-preview-modal {
    border: 0;
    border-radius: 24px;
    overflow: hidden;
}

.gallery-full-image {
    max-height: 80vh;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 16px;
}

#galleryImageModal .modal-body {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-file-preview {
    cursor: pointer;
}

.gallery-viewer-modal {
    border: 0;
    border-radius: 24px;
    overflow: hidden;
}

.gallery-viewer-wrapper {
    position: relative;
    min-height: 500px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-viewer-content {
    width: 100%;
    min-height: 500px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-viewer-image {
    max-width: 100%;
    max-height: 75vh;

    object-fit: contain;

    border-radius: 15px;
}

.gallery-viewer-video {
    width: 100%;
    max-height: 75vh;

    border-radius: 15px;
}

.gallery-viewer-pdf {
    width: 100%;
    height: 70vh;

    border: 0;

    border-radius: 15px;
}

.gallery-navigation {
    position: absolute;

    top: 50%;

    transform: translateY(-50%);

    width: 50px;
    height: 50px;

    border: 0;

    border-radius: 50%;

    background: rgba(0, 0, 0, 0.55);

    color: #fff;

    font-size: 24px;

    z-index: 10;

    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-navigation-prev {
    left: 15px;
}

.gallery-navigation-next {
    right: 15px;
}

.gallery-navigation:disabled {
    opacity: 0.25;

    cursor: not-allowed;
}

.gallery-generic-file {
    text-align: center;

    padding: 50px;
}

.gallery-generic-file > i {
    display: block;

    font-size: 90px;

    margin-bottom: 20px;
}
