/* styles.css */
:root {
    --bg-darker: #0D0E11;
    --bg-main: #14151A;
    --bg-card: #202126;
    --bg-card-hover: #292A30;
    --bg-input: #1C1D22;
    --text-primary: #EDEDF0;
    --text-secondary: #8B8F98;
    --accent-purple: #563DFF;
    --accent-purple-hover: #6B55FF;
    --border-color: #2D303A;
    --avatar-pink: #FF66FF;
    --transition-fast: 0.15s ease;
    --transition-med: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light theme overrides */
body.light {
    --bg-darker: #E8E9ED;
    --bg-main: #F3F4F6;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F0F1F3;
    --bg-input: #E8E9ED;
    --text-primary: #1A1B1E;
    --text-secondary: #6B7280;
    --border-color: #D1D5DB;
    --avatar-pink: #D946EF;
}

body.light .sidebar {
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.08), 3px 0 10px rgba(0, 0, 0, 0.05);
}

body.light .context-menu,
body.light .settings-dropdown {
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

body.light .context-item:hover,
body.light .settings-item:hover,
body.light .sidebar-icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.light .context-divider,
body.light .settings-divider {
    background: rgba(0, 0, 0, 0.08);
}

body.light .project-card {
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

body.light .project-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

body.light .btn-toggle {
    border-color: var(--border-color);
}

body.light .dropdown-panel {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

body.light .dropdown-option:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light .card-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.2) 40%, transparent 65%);
}

body.light .sidebar-search {
    background: rgba(0, 0, 0, 0.05);
}

body.light .sidebar-search:focus-within {
    background: rgba(0, 0, 0, 0.07);
}

/* SVG alignment for context & settings items */
.context-item svg,
.settings-item svg {
    flex-shrink: 0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    display: flex;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hidden {
    display: none !important;
}

/* SVG icon inherit color */
.sidebar-search-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.app-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ===== KEYFRAME ANIMATIONS ===== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0px rgba(86, 61, 255, 0);
    }

    50% {
        box-shadow: 0 0 20px rgba(86, 61, 255, 0.3);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes progressStripe {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 40px 0;
    }
}

@keyframes bgFloat1 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(30px, -30px) scale(1.05);
    }
}

@keyframes bgFloat2 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(-20px, 20px) scale(1.08);
    }
}

/* ===== AUTH VIEW ===== */

.auth-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 14, 17, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn var(--transition-med);
}

.auth-box {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    animation: fadeInScale var(--transition-slow);
}

.auth-box h2 {
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 500;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-group input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(86, 61, 255, 0.15);
}

.auth-switch {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--accent-purple);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-switch a:hover {
    color: var(--accent-purple-hover);
}

/* ===== BUTTONS ===== */

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.btn-primary {
    background-color: var(--accent-purple);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-purple-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(86, 61, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-new-project {
    background-color: var(--accent-purple);
    color: white;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-new-project:hover {
    background-color: var(--accent-purple-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(86, 61, 255, 0.3);
}

.btn-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-toggle:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}

.btn-toggle:last-child {
    border-radius: 0 6px 6px 0;
}

.btn-toggle.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-toggle:hover:not(.active) {
    background: rgba(255, 255, 255, 0.03);
}

.icon-btn {
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.icon-text {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.full-width {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
}

/* ===== MAIN LAYOUT ===== */

.main-layout {
    display: flex;
    height: 100%;
    width: 100%;
    animation: fadeIn var(--transition-slow);
}

/* ===== SIDEBAR ===== */

.sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--bg-darker);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.8rem 1.2rem 1.2rem;
    z-index: 20;
    box-shadow:
        8px 0 24px rgba(0, 0, 0, 0.45),
        3px 0 10px rgba(0, 0, 0, 0.3);
    animation: fadeIn var(--transition-slow);
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.sidebar-search {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar-search:focus-within {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(86, 61, 255, 0.2);
}

.sidebar-search .icon {
    font-size: 0.7rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.sidebar-search input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-size: 0.78rem;
}

.sidebar-search input::placeholder {
    color: #555;
}

.sidebar-upload {
    width: 100%;
    justify-content: center;
}

.sidebar-bottom {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sidebar-icon-btn {
    background: transparent;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    transition: all var(--transition-fast);
    line-height: 1;
    color: var(--text-secondary);
}

.sidebar-icon-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.05);
}

/* ===== SETTINGS DROPDOWN ===== */

.settings-wrapper {
    position: relative;
}

.settings-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    z-index: 900;
    padding: 0.5rem;
    animation: fadeInScale var(--transition-slow);
}

.settings-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
}

.settings-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--avatar-pink);
    color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.settings-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0.3rem 0;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.settings-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

/* ===== RIGHT CONTENT ===== */

.right-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    overflow: hidden;
}

/* ===== MAIN CONTENT AREA ===== */

.main-content-area {
    padding: 1.5rem 2.5rem;
    flex: 1;
    overflow-y: auto;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    margin-bottom: 1.5rem;
    animation: fadeInUp var(--transition-slow) 0.15s both;
    position: relative;
    z-index: 10;
    overflow: visible;
}

.landing-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-darker);
    display: flex;
    flex-direction: column;
    z-index: 500;
    overflow: hidden;
}

.landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    z-index: 10;
    animation: slideInDown 0.6s ease;
}

.landing-logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.landing-nav-actions {
    display: flex;
    gap: 1rem;
}

.landing-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    z-index: 10;
}

.landing-content h1 {
    font-size: 4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff, #999);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    max-width: 800px;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.landing-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 600px;
    animation: fadeInUp 0.8s ease 0.4s both;
}

.landing-actions {
    animation: fadeInUp 0.8s ease 0.6s both;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 1;
    opacity: 0.15;
}

.bg-shape.circle-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-purple);
    top: -100px;
    right: -100px;
    animation: bgFloat1 8s ease-in-out infinite;
}

.bg-shape.circle-2 {
    width: 400px;
    height: 400px;
    background: #FF66A1;
    bottom: -50px;
    left: -50px;
    animation: bgFloat2 10s ease-in-out infinite;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
}



.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.08);
}

.custom-dropdown {
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.dropdown-trigger:hover {
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.dropdown-trigger svg {
    opacity: 0.5;
    transition: transform var(--transition-fast);
}

.custom-dropdown.open .dropdown-trigger {
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.custom-dropdown.open .dropdown-trigger svg {
    transform: rotate(180deg);
}

.dropdown-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 160px;
    background: #1e1f26;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.35rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    animation: fadeInUp 0.15s ease;
}

.dropdown-option {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-option:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.dropdown-option.active {
    color: var(--accent-purple);
    background: rgba(86, 61, 255, 0.1);
}

.storage-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.view-toggles {
    display: flex;
}

/* ===== PROJECT GRID ===== */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    animation: fadeInUp var(--transition-slow) 0.3s both;
}

.project-card {
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-med);
    display: flex;
    flex-direction: column;
    animation: fadeInScale var(--transition-slow) both;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.project-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.06);
}

/* ===== LIST VIEW ===== */

.project-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-grid.list-view .project-card {
    flex-direction: row;
    height: 64px;
    align-items: center;
}

.project-grid.list-view .project-card:hover {
    transform: translateX(4px);
}

.project-grid.list-view .proj-thumbnail {
    width: 64px;
    flex: none;
    font-size: 1.5rem;
}

.project-grid.list-view .proj-thumbnail .proj-icon-top {
    display: none;
}

.project-grid.list-view .proj-info {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    padding: 0 1.5rem;
}

.project-grid.list-view .proj-info>* {
    flex: 1;
}

.project-grid.list-view .proj-footer {
    justify-content: flex-end;
}

.project-grid.list-view .new-project-card {
    height: 64px;
    flex-direction: row;
    gap: 1.5rem;
    padding: 0 2rem;
    justify-content: flex-start;
}

.project-grid.list-view .plus-circle {
    width: 32px;
    height: 32px;
    font-size: 1rem;
}

/* ===== CARD DETAILS (Full-bleed overlay style) ===== */

.card-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #15161a;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.card-thumb-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb-icon {
    font-size: 2.5rem;
    opacity: 0.25;
    z-index: 1;
}

/* Bottom gradient overlay with metadata */
.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.3) 40%, transparent 65%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.8rem 1rem;
    z-index: 2;
    transition: background var(--transition-fast);
}

.project-card:hover .card-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.35) 45%, transparent 70%);
}

.card-meta-bottom {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.card-filename {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.card-meta-line {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.02em;
}

/* Top-right three-dot menu */
.card-menu-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition-fast);
    z-index: 3;
    line-height: 1;
    padding-bottom: 4px;
}

.project-card:hover .card-menu-btn {
    opacity: 1;
}

.card-menu-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

/* ===== NEW PROJECT CARD ===== */

.new-project-card {
    background: var(--bg-card);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1rem;
    border: 2px dashed rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    transition: all var(--transition-med);
}

.new-project-card:hover {
    border-color: var(--accent-purple);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
}

.new-project-card:hover .plus-circle {
    background: rgba(86, 61, 255, 0.2);
    color: var(--accent-purple);
}

.plus-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 300;
    transition: all var(--transition-med);
}

.new-proj-text {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== UPLOAD PROGRESS BAR ===== */

.upload-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    min-width: 340px;
    max-width: 380px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.upload-entry {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    animation: fadeInUp var(--transition-slow);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.upload-entry .upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-entry .upload-header span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.upload-entry .upload-header small {
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.upload-progress-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-purple-hover));
    border-radius: 2px;
    transition: width 0.3s ease;
    background-size: 40px 40px;
}

.upload-progress-fill.active {
    animation: progressStripe 0.6s linear infinite;
    background-image: linear-gradient(45deg,
            rgba(255, 255, 255, 0.1) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.1) 75%,
            transparent 75%);
}

.upload-entry.done .upload-progress-fill {
    background: #22c55e;
    animation: none;
}

/* ===== FILE PREVIEW OVERLAY ===== */

.file-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #090a0c;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    animation: fadeIn var(--transition-med);
}

.preview-top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 2010;
    animation: slideInDown var(--transition-slow);
}

.preview-nav-left,
.preview-nav-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-breadcrumb {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Polished Preview Buttons */
.preview-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.preview-btn:active {
    transform: scale(0.95);
}

.preview-btn.close-btn {
    font-size: 1.1rem;
    padding: 0.4rem 0.8rem;
    margin-right: 0.5rem;
}

.preview-counter {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0 0.3rem;
    min-width: 50px;
    text-align: center;
}

.preview-content-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.preview-content-area>video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    animation: fadeInScale var(--transition-slow);
}

.pdf-preview-embed {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
    animation: fadeIn 0.3s ease;
}

/* Reduce padding when PDF is shown to maximize space */
.preview-content-area:has(.pdf-preview-embed) {
    padding: 0 10px 10px;
}

/* ===== IMAGE ZOOM + PAN ===== */

.img-zoom-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: zoom-in;
}

.img-zoom-container.zoomed {
    overflow: auto;
    cursor: grab;
}

/* Hide scrollbar during zoom pan */
.img-zoom-container.zoomed::-webkit-scrollbar {
    display: none;
}

.img-zoom-container.zoomed {
    scrollbar-width: none;
}

.zoomable-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    transform: scale(1);
    transform-origin: center center;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: fadeInScale var(--transition-slow);
    will-change: transform;
}

.zoomable-img.zoomed {
    transform: scale(2.5);
    cursor: grab;
}

/* ===== CUSTOM CONTEXT MENU ===== */

.context-menu {
    position: fixed;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
    z-index: 5000;
    padding: 0.4rem;
    animation: fadeInScale 0.15s ease;
}

.context-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.8rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-fast);
    text-align: left;
}

.context-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.context-item-danger:hover {
    background: rgba(255, 60, 60, 0.12);
    color: #ff6b6b;
}

.context-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0.3rem 0;
}

/* ===== VIDEO PLAY BADGE (thumbnail overlay) ===== */

.video-play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    backdrop-filter: blur(4px);
    transition: all var(--transition-fast);
    z-index: 5;
}

.project-card:hover .video-play-badge {
    background: var(--accent-purple);
    transform: translate(-50%, -50%) scale(1.1);
}

/* ===== CUSTOM VIDEO PLAYER ===== */

.custom-player {
    position: relative;
    width: 100%;
    max-width: 90vw;
    max-height: 85vh;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-player video#cpVideo {
    width: 100%;
    height: 100%;
    max-height: 85vh;
    object-fit: contain;
    display: block;
}

/* Hide SVG icon toggle */
.cp-svg-hidden {
    display: none !important;
}

/* Big center play overlay */
.cp-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: opacity var(--transition-fast);
    z-index: 2;
}

.cp-overlay.cp-hidden {
    opacity: 0;
    pointer-events: none;
}

.cp-big-play {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(86, 61, 255, 0.85);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(8px);
}

.cp-big-play svg {
    margin-left: 3px;
}

.cp-big-play:hover {
    transform: scale(1.1);
    background: rgba(86, 61, 255, 1);
}

/* ===== Bottom control area ===== */
.cp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    padding: 3rem 1.4rem 1rem;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.92) 0%,
            rgba(0, 0, 0, 0.65) 40%,
            rgba(0, 0, 0, 0.15) 75%,
            transparent 100%);
    z-index: 3;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-player:hover .cp-controls {
    opacity: 1;
}

/* --- Scrubber Row --- */
.cp-scrub-row {
    position: relative;
    width: 100%;
    padding-bottom: 2px;
}

.cp-scrub {
    position: relative;
    width: 100%;
    height: 24px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.cp-scrub-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    top: 50%;
    transform: translateY(-50%);
    transition: height 0.15s ease;
    overflow: hidden;
}

.cp-scrub:hover .cp-scrub-track {
    height: 5px;
}

.cp-scrub-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 2px;
}

.cp-scrub-thumb {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    left: 0%;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.cp-scrub:hover .cp-scrub-thumb {
    opacity: 1;
}

/* --- Preview Tooltip --- */
.cp-preview-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.cp-preview-tooltip canvas {
    width: 160px;
    height: 90px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: #111;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65);
}

.cp-preview-time {
    font-size: 0.75rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    padding: 2px 10px;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* --- Time Row --- */
.cp-time-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 2px 8px;
}

.cp-time-current,
.cp-time-duration {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

/* --- Controls Row --- */
.cp-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cp-controls-left,
.cp-controls-center,
.cp-controls-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cp-controls-left,
.cp-controls-right {
    flex: 1;
}

.cp-controls-right {
    justify-content: flex-end;
}

.cp-controls-center {
    gap: 1rem;
}

/* --- Buttons --- */
.cp-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    border-radius: 50%;
    line-height: 1;
}

.cp-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.08);
}

.cp-btn:active {
    transform: scale(0.95);
}

.cp-play-main {
    width: 48px;
    height: 48px;
}

.cp-play-main svg {
    width: 30px;
    height: 30px;
}

.cp-play-main .cp-icon-play svg {
    margin-left: 2px;
}

.cp-skip-btn {
    opacity: 0.85;
}

.cp-skip-btn:hover {
    opacity: 1;
}

.cp-vol-btn {
    padding: 8px;
}

/* --- Volume Slider --- */
.cp-vol {
    width: 70px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.cp-vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.cp-vol::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
}