/* ========================================
   ZVLZ Files — Theme System & Styles
   Ported from UploadServer's style.css
   ======================================== */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600;700&display=swap');

/* --- Theme Variables --- */
:root {
    --font-mono: 'Geist Mono', monospace;
    --transition-speed: 0.3s;
    --border-radius: 12px;
    --blur: 12px;
}

[data-theme="tokyo-night"] {
    --bg: #1a1b26;
    --fg: #c0caf5;
    --surface: rgba(36, 40, 59, 0.8);
    --overlay: rgba(41, 46, 66, 0.9);
    --primary: #7aa2f7;
    --secondary: #bb9af7;
    --accent: #ff9e64;
    --error: #f7768e;
    --subtle: #565f89;
    --gradient-start: #1a1b26;
    --gradient-end: #24283b;
}

[data-theme="rose-pine"] {
    --bg: #191724;
    --fg: #e0def4;
    --surface: rgba(30, 28, 47, 0.8);
    --overlay: rgba(38, 35, 58, 0.9);
    --primary: #c4a7e7;
    --secondary: #ebbcba;
    --accent: #f6c177;
    --error: #eb6f92;
    --subtle: #6e6a86;
    --gradient-start: #191724;
    --gradient-end: #1f1d2e;
}

[data-theme="catppuccin-mocha"] {
    --bg: #1e1e2e;
    --fg: #cdd6f4;
    --surface: rgba(30, 30, 46, 0.8);
    --overlay: rgba(49, 50, 68, 0.9);
    --primary: #89b4fa;
    --secondary: #cba6f7;
    --accent: #f9e2af;
    --error: #f38ba8;
    --subtle: #6c7086;
    --gradient-start: #1e1e2e;
    --gradient-end: #181825;
}

[data-theme="catppuccin-macchiato"] {
    --bg: #24273a;
    --fg: #cad3f5;
    --surface: rgba(36, 39, 58, 0.8);
    --overlay: rgba(54, 58, 79, 0.9);
    --primary: #8aadf4;
    --secondary: #c6a0f6;
    --accent: #eed49f;
    --error: #ed8796;
    --subtle: #6e738d;
    --gradient-start: #24273a;
    --gradient-end: #1e2030;
}

[data-theme="catppuccin-frappe"] {
    --bg: #303446;
    --fg: #c6d0f5;
    --surface: rgba(48, 52, 70, 0.8);
    --overlay: rgba(65, 69, 89, 0.9);
    --primary: #8caaee;
    --secondary: #ca9ee6;
    --accent: #e5c890;
    --error: #e78284;
    --subtle: #737994;
    --gradient-start: #303446;
    --gradient-end: #292c3c;
}

[data-theme="catppuccin-latte"] {
    --bg: #eff1f5;
    --fg: #4c4f69;
    --surface: rgba(230, 233, 239, 0.85);
    --overlay: rgba(204, 208, 218, 0.9);
    --primary: #1e66f5;
    --secondary: #8839ef;
    --accent: #df8e1d;
    --error: #d20f39;
    --subtle: #9ca0b0;
    --gradient-start: #eff1f5;
    --gradient-end: #e6e9ef;
}

[data-theme="nord"] {
    --bg: #2e3440;
    --fg: #eceff4;
    --surface: rgba(46, 52, 64, 0.8);
    --overlay: rgba(59, 66, 82, 0.9);
    --primary: #88c0d0;
    --secondary: #81a1c1;
    --accent: #ebcb8b;
    --error: #bf616a;
    --subtle: #4c566a;
    --gradient-start: #2e3440;
    --gradient-end: #3b4252;
}

[data-theme="gruvbox-dark"] {
    --bg: #282828;
    --fg: #ebdbb2;
    --surface: rgba(40, 40, 40, 0.8);
    --overlay: rgba(60, 56, 54, 0.9);
    --primary: #83a598;
    --secondary: #d3869b;
    --accent: #fabd2f;
    --error: #fb4934;
    --subtle: #665c54;
    --gradient-start: #282828;
    --gradient-end: #3c3836;
}

[data-theme="gruvbox-light"] {
    --bg: #fbf1c7;
    --fg: #3c3836;
    --surface: rgba(242, 229, 188, 0.85);
    --overlay: rgba(213, 196, 161, 0.9);
    --primary: #427b58;
    --secondary: #8f3f71;
    --accent: #b57614;
    --error: #9d0006;
    --subtle: #928374;
    --gradient-start: #fbf1c7;
    --gradient-end: #f2e5bc;
}

[data-theme="dracula"] {
    --bg: #282a36;
    --fg: #f8f8f2;
    --surface: rgba(40, 42, 54, 0.8);
    --overlay: rgba(68, 71, 90, 0.9);
    --primary: #bd93f9;
    --secondary: #ff79c6;
    --accent: #f1fa8c;
    --error: #ff5555;
    --subtle: #6272a4;
    --gradient-start: #282a36;
    --gradient-end: #44475a;
}

[data-theme="monokai-pro"] {
    --bg: #2d2a2e;
    --fg: #fcfcfa;
    --surface: rgba(45, 42, 46, 0.8);
    --overlay: rgba(57, 53, 58, 0.9);
    --primary: #78dce8;
    --secondary: #ab9df2;
    --accent: #ffd866;
    --error: #ff6188;
    --subtle: #727072;
    --gradient-start: #2d2a2e;
    --gradient-end: #403e41;
}

[data-theme="solarized-light"] {
    --bg: #fdf6e3;
    --fg: #657b83;
    --surface: rgba(238, 232, 213, 0.85);
    --overlay: rgba(220, 214, 195, 0.9);
    --primary: #268bd2;
    --secondary: #6c71c4;
    --accent: #b58900;
    --error: #dc322f;
    --subtle: #93a1a1;
    --gradient-start: #fdf6e3;
    --gradient-end: #eee8d5;
}

[data-theme="solarized-dark"] {
    --bg: #002b36;
    --fg: #839496;
    --surface: rgba(0, 43, 54, 0.8);
    --overlay: rgba(7, 54, 66, 0.9);
    --primary: #268bd2;
    --secondary: #6c71c4;
    --accent: #b58900;
    --error: #dc322f;
    --subtle: #586e75;
    --gradient-start: #002b36;
    --gradient-end: #073642;
}

[data-theme="one-dark-pro"] {
    --bg: #282c34;
    --fg: #abb2bf;
    --surface: rgba(40, 44, 52, 0.8);
    --overlay: rgba(50, 56, 66, 0.9);
    --primary: #61afef;
    --secondary: #c678dd;
    --accent: #e5c07b;
    --error: #e06c75;
    --subtle: #5c6370;
    --gradient-start: #282c34;
    --gradient-end: #21252b;
}

[data-theme="ayu-dark"] {
    --bg: #0b0e14;
    --fg: #bfbdb6;
    --surface: rgba(11, 14, 20, 0.8);
    --overlay: rgba(27, 30, 38, 0.9);
    --primary: #e6b450;
    --secondary: #d2a6ff;
    --accent: #ffb454;
    --error: #d95757;
    --subtle: #565b66;
    --gradient-start: #0b0e14;
    --gradient-end: #131721;
}

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

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

body {
    font-family: var(--font-mono);
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end), var(--gradient-start));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: var(--fg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    transition: background var(--transition-speed), color var(--transition-speed);
}

/* --- Container --- */
.container {
    width: 100%;
    max-width: 800px;
    max-height: 750px;
    overflow-y: auto;
    background-color: var(--surface);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--overlay);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease-out;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

/* Scrollbar */
.container::-webkit-scrollbar {
    width: 6px;
}

.container::-webkit-scrollbar-track {
    background: transparent;
}

.container::-webkit-scrollbar-thumb {
    background-color: var(--subtle);
    border-radius: 3px;
}

/* --- Header --- */
header {
    text-align: center;
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Color Palette --- */
.color-palette-display {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--overlay);
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
}

.color-swatch:hover {
    transform: scale(1.3);
    border-color: var(--primary);
}

/* --- Breadcrumb --- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--overlay);
    border-radius: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.breadcrumb-item {
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color var(--transition-speed);
}

.breadcrumb-item:hover {
    color: var(--secondary);
}

.breadcrumb-item.current {
    color: var(--fg);
    font-weight: 600;
}

.breadcrumb-item .material-icons {
    font-size: 1.1rem;
}

.breadcrumb-sep {
    color: var(--subtle);
    user-select: none;
}

/* --- Search --- */
.search-section {
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background-color: var(--surface);
    border: 1px solid var(--overlay);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    transition: border-color var(--transition-speed), background-color var(--transition-speed);
}

.input-group:focus-within {
    border-color: var(--primary);
}

.input-group .material-icons {
    color: var(--subtle);
    flex-shrink: 0;
    font-size: 1.2rem;
}

.input-group input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    padding: 0;
    font-size: 0.95rem;
    font-family: var(--font-mono);
    caret-color: var(--primary);
}

.input-group input::placeholder {
    color: var(--subtle);
}

/* --- File List --- */
.file-list-section ul {
    list-style: none;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

.file-list-section ul::-webkit-scrollbar {
    width: 4px;
}

.file-list-section ul::-webkit-scrollbar-track {
    background: transparent;
}

.file-list-section ul::-webkit-scrollbar-thumb {
    background-color: var(--subtle);
    border-radius: 2px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    transition: background-color var(--transition-speed);
    animation: fadeIn 0.3s ease-out backwards;
}

.file-item:hover {
    background-color: var(--overlay);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.file-info a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--fg);
    text-decoration: none;
    transition: color var(--transition-speed);
    flex: 1;
    min-width: 0;
}

.file-info a:hover {
    color: var(--primary);
}

.file-info a .material-icons {
    font-size: 1.2rem;
    color: var(--primary);
    flex-shrink: 0;
}

.parent-dir .file-info a .material-icons {
    color: var(--accent);
}

.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.8rem;
    color: var(--subtle);
    white-space: nowrap;
    margin-left: auto;
    padding-left: 1rem;
}

/* --- File Actions --- */
.file-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.action-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--subtle);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.action-btn:hover {
    background-color: var(--overlay);
    color: var(--primary);
    border-color: var(--primary);
}

.action-btn .material-icons {
    font-size: 1rem;
}

.action-btn.copied {
    color: var(--accent);
    border-color: var(--accent);
}

/* --- Stats Bar --- */
.stats-bar {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    padding-top: 1rem;
    font-size: 0.8rem;
    color: var(--subtle);
    border-top: 1px solid var(--overlay);
    margin-top: 1rem;
}

.stats-sep {
    user-select: none;
}

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: var(--subtle);
}

.empty-state .material-icons {
    font-size: 3rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
}

/* --- Toast Notification --- */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: var(--overlay);
    color: var(--fg);
    border: 1px solid var(--primary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 2000;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Footer --- */
footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--subtle);
    font-size: 0.85rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-speed);
}

footer a:hover {
    color: var(--secondary);
}

/* --- Theme Carousel --- */
.theme-switcher.theme-carousel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0;
    background-color: var(--surface);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--overlay);
    border-radius: 10px;
    padding: 4px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.theme-carousel .theme-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--subtle);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border-radius: 8px;
    transition: all var(--transition-speed);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.theme-carousel .theme-btn:hover {
    background-color: var(--overlay);
    color: var(--primary);
    border-color: var(--primary);
}

.theme-carousel .theme-btn.pressed {
    transform: scale(0.92);
}

.theme-carousel .theme-display {
    width: 200px;
    min-width: 180px;
    text-align: center;
    padding: 0.5rem 0.75rem;
    color: var(--fg);
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-label {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}

.theme-label.incoming {
    opacity: 0;
}

.theme-label.enter-from-right {
    transform: translateX(100%);
}

.theme-label.enter-from-left {
    transform: translateX(-100%);
}

.theme-label.enter-to {
    transform: translateX(0);
    opacity: 1;
}

.theme-label.exit-to-left {
    transform: translateX(-100%);
    opacity: 0;
}

.theme-label.exit-to-right {
    transform: translateX(100%);
    opacity: 0;
}

/* --- Responsive --- */
@media (min-width: 768px) {
    .container {
        margin: 2rem auto;
        padding: 2rem;
    }

    .theme-carousel .theme-display {
        width: 220px;
    }
}

@media (max-width: 767px) {
    body {
        padding: 0.75rem;
        justify-content: flex-start;
    }

    .container {
        margin: 1rem auto;
        padding: 1.25rem;
        max-height: none;
        overflow-y: visible;
        width: calc(100% - 1rem);
    }

    header {
        margin-bottom: 1rem;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .breadcrumb {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }

    .file-list-section ul {
        max-height: 45vh;
    }

    .theme-switcher.theme-carousel {
        position: fixed;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        padding: 4px;
    }

    .theme-carousel .theme-display {
        width: 160px;
        min-width: 140px;
        font-size: 0.9rem;
        padding: 0.4rem 0.6rem;
    }

    .theme-carousel .theme-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }

    .container {
        padding: 1rem;
        margin: 0.5rem auto;
        width: calc(100% - 0.5rem);
        border-radius: 10px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .file-item {
        padding: 0.5rem 0.6rem;
        font-size: 0.9rem;
    }

    .file-info a .material-icons {
        font-size: 1rem;
    }

    .theme-switcher.theme-carousel {
        bottom: 10px;
        padding: 3px;
    }

    .theme-carousel .theme-display {
        width: 140px;
        min-width: 120px;
        font-size: 0.85rem;
        padding: 0.35rem 0.5rem;
    }

    .theme-carousel .theme-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.85rem;
    }

    .color-swatch {
        width: 16px;
        height: 16px;
    }

    footer {
        margin-top: 1rem;
        font-size: 0.8rem;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 900px;
        max-height: 800px;
    }

    .theme-carousel .theme-display {
        width: 240px;
    }
}

@media (max-height: 600px) and (orientation: landscape) {
    .container {
        max-height: 85vh;
        overflow-y: auto;
        margin: 0.5rem auto;
    }

    .file-list-section ul {
        max-height: 30vh;
    }
}

/* --- Accessibility --- */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    :root {
        --border-radius: 4px;
        --blur: 0px;
    }

    .container {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background-color: var(--surface);
    }
}

@media print {

    .theme-switcher,
    footer,
    .search-section,
    .file-actions,
    .toast {
        display: none !important;
    }

    .container {
        border: none;
        background: white;
        color: black;
        max-height: none;
        overflow: visible;
    }

    .file-list-section ul {
        max-height: none;
        overflow: visible;
    }
}