:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --surface-hover: #2c2c2c;
    --primary-color: #bb86fc;
    --text-primary: #ffffff;
    --text-sec: #b3b3b3;
    --border-color: #333333;
    --border-radius: 8px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 600;
}

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

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #000;
}

.btn-primary:hover {
    background-color: #9965f4;
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--surface-hover);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .logo a {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.navbar .nav-links {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 16px;
}

/* Auth Pages */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 150px);
}

.login-card {
    background-color: var(--surface-color);
    padding: 40px;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.login-card p {
    color: var(--text-sec);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-size: 16px;
}

.error-msg {
    color: #ff5252;
    margin-bottom: 16px;
    font-size: 14px;
}

/* Browser View */
.browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.breadcrumbs {
    font-size: 18px;
    color: var(--text-sec);
}

.breadcrumbs a {
    color: var(--text-primary);
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* Cards */
.folder-card,
.file-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.folder-card:hover,
.file-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.folder-card {
    padding: 16px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.folder-card .icon {
    font-size: 24px;
}

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

/* File Card specific */
.file-card .thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.file-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-card .placeholder {
    font-size: 48px;
}

.file-card .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    opacity: 0.8;
}

.file-card .info {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
}

.file-card .info .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 0;
    color: var(--text-sec);
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    border: 1px dashed var(--border-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--surface-color);
    padding: 32px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    margin-bottom: 24px;
    text-align: center;
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 24px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-sec);
    cursor: pointer;
}

.close-modal:hover {
    color: var(--text-primary);
}

/* Viewer specific */
#viewer-img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Progress bar */
.progress-bar-bg {
    width: 100%;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    height: 8px;
    border: 1px solid var(--border-color);
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* Drag & Selection UI */
.item-card.selected {
    outline: 3px solid var(--primary-color);
}

.dropzone.dragover {
    border: 2px dashed var(--primary-color);
    background-color: rgba(187, 134, 252, 0.1);
}

/* Viewer Nav Buttons */
.viewer-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 36px;
    cursor: pointer;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1010;
}

.viewer-nav-btn:hover {
    background: rgba(187, 134, 252, 0.8);
}

.prev-btn {
    left: 16px;
}

.next-btn {
    right: 16px;
}

/* Filter controls */
.filter-controls {
    display: inline-flex;
    gap: 12px;
    margin-right: 12px;
    align-items: center;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-sec);
    cursor: pointer;
    user-select: none;
}

.filter-label input[type="checkbox"] {
    accent-color: var(--primary-color);
}

/* Like button on cards */
.like-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.file-card:hover .like-btn,
.file-card[data-liked="true"] .like-btn {
    opacity: 1;
}

.like-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Viewer top controls */
.viewer-top-controls {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 1010;
}

.viewer-ctrl-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.viewer-ctrl-btn:hover {
    background: rgba(187, 134, 252, 0.8);
}

/* Tag chips */
.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    background: var(--surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.tag-chip:hover {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
}

/* Toast notification */
.tag-applied-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: #000;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 2000;
    animation: toast-fade 2s ease forwards;
}

@keyframes toast-fade {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

/* Responsive adjustments for browser header */
.browser-header {
    flex-wrap: wrap;
    gap: 12px;
}

.controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}