:root {
    --primary-color: #00f3ff;
    --secondary-color: #bc13fe;
    --danger-color: #ff3333;
    /* New danger color for delete */
    --bg-dark: #050510;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-dim: #a0a0b0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "KaiTi", "楷体", serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Start from top to avoid clipping on overflow */
    padding: 50px 0;
    /* Add some spacing */
    overflow-y: auto;
    /* Allow body scroll */
    position: relative;
    background: radial-gradient(circle at center, #1a1a2e 0%, #000000 100%);
    background-attachment: fixed;
    /* Keep background static */
}

/* Background Animation (Moving Cubes) */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.cube {
    position: absolute;
    top: 80vh;
    left: 45vw;
    width: 10px;
    height: 10px;
    border: solid 1px var(--primary-color);
    transform-origin: top left;
    transform: scale(0) rotate(0deg) translate(-50%, -50%);
    animation: cube 12s ease-in forwards infinite;
}

.cube:nth-child(2n) {
    border-color: var(--secondary-color);
}

.cube:nth-child(2) {
    animation-delay: 2s;
    left: 25vw;
    top: 40vh;
}

.cube:nth-child(3) {
    animation-delay: 4s;
    left: 75vw;
    top: 50vh;
}

.cube:nth-child(4) {
    animation-delay: 6s;
    left: 90vw;
    top: 10vh;
}

.cube:nth-child(5) {
    animation-delay: 8s;
    left: 10vw;
    top: 85vh;
}

.cube:nth-child(6) {
    animation-delay: 10s;
    left: 50vw;
    top: 10vh;
}

@keyframes cube {
    from {
        transform: scale(0) rotate(0deg) translate(-50%, -50%);
        opacity: 1;
    }

    to {
        transform: scale(20) rotate(960deg) translate(-50%, -50%);
        opacity: 0;
    }
}

/* Glass Container */
.glass-container {
    width: 90%;
    max-width: 800px;
    min-height: 80vh;
    /* Minimum height instead of fixed */
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
    /* overflow: hidden; Removed to allow dropdowns/modals if needed, but mainly for flow */
}

.glass-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 243, 255, 0.1) 0%, transparent 60%);
    animation: rotate 20s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-family: "KaiTi", "楷体", serif;
    font-size: 3rem;
    letter-spacing: 5px;
    text-shadow: 0 0 10px var(--primary-color);
}

.highlight {
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-dim);
    letter-spacing: 3px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.2);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2) inset;
    background: rgba(0, 243, 255, 0.05);
}

.password-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    margin-top: 1rem;
    width: 60%;
    font-family: "KaiTi", "楷体", serif;
    outline: none;
    transition: all 0.3s;
    text-align: center;
}

.password-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

/* Fix Webkit Autofill Background */
.password-input:-webkit-autofill,
.password-input:-webkit-autofill:hover,
.password-input:-webkit-autofill:focus,
.password-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.1) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Info Bubble */
.info-bubble {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--primary-color);
    padding: 1rem;
    border-radius: 12px;
    z-index: 2000;
    max-width: 300px;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
    animation: bubble-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-main);
    pointer-events: none;
    pointer-events: auto;
    transform: translateX(-50%);
    /* Center horizontally */
}

.info-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: var(--primary-color) transparent transparent transparent;
}

@keyframes bubble-pop {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8) translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1) translateY(0);
    }
}

.icon-container {
    font-size: 3rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
    transition: color 0.3s;
}

.upload-area:hover .icon-container {
    color: var(--primary-color);
}

/* File List */
.file-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--secondary-color);
    font-weight: bold;
    letter-spacing: 1px;
}

.file-list {
    flex: 1;
    /* overflow-y: auto; Removed internal scroll */
    padding-top: 1rem;
}

.file-list::-webkit-scrollbar {
    width: 5px;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 5px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 0.5rem;
    border-radius: 12px;
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: grab;
    position: relative;
    overflow: hidden;
}

/* SortableJS Styles */
.file-item.sortable-ghost {
    opacity: 0;
    /* Hide the original element placeholder */
}

.file-item.sortable-drag {
    background: var(--bg-dark);
    /* Ensure the dragged item has background */
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
    opacity: 1 !important;
    /* Ensure dragged item is fully visible */
    cursor: grabbing;
}

.file-item.sortable-fallback {
    /* If using forceFallback, this styles the cloned item */
    pointer-events: none;
    z-index: 9999;
}

.file-item:active {
    cursor: grabbing;
    /* Removed transform: scale(0.99) to stop shuffling */
}

.file-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0.5;
    transition: opacity 0.3s;
}

.file-item:hover {
    /* No movement or scaling */
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.3), 0 0 60px rgba(0, 243, 255, 0.2);
    /* Enhanced fog/glow */
    z-index: 10;
}

.file-item:hover::before {
    opacity: 1;
    box-shadow: 0 0 15px var(--primary-color);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    /* Allow file info to take available space */
}

.fa-lock {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.download-count {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    width: 80px;
    justify-content: flex-end;
}

.file-size {
    width: 100px;
    text-align: right;
    margin-right: 1rem;
}

.file-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.file-name {
    font-size: 1.1rem;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 2rem;
    color: var(--text-dim);
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.download-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: "KaiTi", "楷体", serif;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.download-btn:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 15px var(--primary-color);
}

.delete-btn {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.delete-btn:hover {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 0 10px var(--danger-color);
}

.loading {
    text-align: center;
    color: var(--text-dim);
    margin-top: 2rem;
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.hidden {
    display: none;
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: #333;
    margin-top: 1rem;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    transition: width 0.1s;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    z-index: 1001;
    animation: modal-pop 0.3s ease-out;
    width: 320px;
    /* Smaller width */
    padding: 1.5rem;
    /* Reduced padding */
    border-radius: 15px;
    background: rgba(10, 10, 20, 0.85);
    /* Slightly darker for better contrast */
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.15);
    text-align: center;
}

@keyframes modal-pop {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#modal-title {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-family: "KaiTi", "楷体", serif;
    /* Consistent font */
    font-size: 1.5rem;
    letter-spacing: 2px;
}

#modal-message {
    margin-bottom: 1.5rem;
    color: var(--text-main);
    font-size: 1rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: center;
    /* Center buttons */
    gap: 1rem;
    margin-top: 1rem;
}

.modal-btn {
    flex: 1;
    /* Equal width */
    padding: 0.5rem 0;
    border-radius: 5px;
    cursor: pointer;
    font-family: "KaiTi", "楷体", serif;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s;
    background: transparent;
    text-align: center;
}

.modal-btn.cancel {
    border: 1px solid var(--text-dim);
    color: var(--text-dim);
}

.modal-btn.cancel:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.modal-btn.confirm {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.modal-btn.confirm:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 10px var(--primary-color);
}
/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}
