/* journey.css - The Vault Edition */

/* Fix for animation glitch on search bar */
.music-search-section.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
    animation-fill-mode: both;
    /* Prevents flash before animation starts */
}

.vault-container {
    display: flex;
    min-height: calc(100vh - 80px);
    margin-top: 80px;
    background: transparent;
    position: relative;
    overflow: hidden;
}

/* 1. Background Morpher Layer */
.journey-background-morpher {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    background: transparent;
}

.bg-media-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 1s ease-in-out;
}

.bg-media-layer video,
.bg-media-layer .bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.4) saturate(0.8);
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent, rgba(0, 0, 0, 0.2));
    background: radial-gradient(circle at center, transparent, rgba(0, 0, 0, 0.2));
    z-index: 1;
}

/* --- Upload Queue Styles --- */
.upload-queue {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

.queue-item:last-child {
    border-bottom: none;
}

.queue-thumb {
    width: 60px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

.queue-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.queue-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.queue-input {
    background: transparent;
    border: none;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 2px 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.queue-input.date {
    font-size: 0.8rem;
    color: #aaa;
}

.queue-status {
    font-size: 0.75rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 10px;
}

.queue-progress-bar {
    width: 100px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.queue-progress-bar div {
    height: 100%;
    background: var(--accent-red);
    width: 0%;
    transition: width 0.2s ease;
}

.queue-remove {
    background: transparent;
    border: none;
    color: #ff4444;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 10px;
}

.queue-item.success {
    border-left: 3px solid #44ff44;
}

.queue-item.error {
    border-left: 3px solid #ff4444;
}

/* --- 1. Sidebar Timeline --- */
.vault-sidebar {
    width: 250px;
    background: rgba(15, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 0, 0, 0.1);
    padding: 60px 40px;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
}

.sidebar-timeline {
    position: relative;
}

.timeline-line {
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.timeline-node {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.node-dot {
    width: 16px;
    height: 16px;
    background: #222;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    z-index: 1;
}

.timeline-node:hover .node-dot,
.timeline-node.active .node-dot {
    background: var(--accent-red);
    border-color: var(--accent-red);
    box-shadow: 0 0 10px var(--accent-red);
}

.timeline-node:hover .node-label,
.timeline-node.active .node-label {
    color: white;
    font-weight: 700;
}

.node-label {
    font-family: 'Outfit', sans-serif;
    letter-spacing: 2px;
    font-size: 0.9rem;
}

/* --- 2. Main Content Area --- */
.vault-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px;
    position: relative;
    z-index: 2;
    min-width: 0;
    /* Prevent flex item from being forced wide by content */
}

/* --- Journey Hub v3 Controls --- */
.journey-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.search-wrapper {
    position: relative;
    max-width: 500px;
    flex: 1;
    border-radius: 30px;
    padding: 2px;
}

.search-wrapper input {
    width: 100%;
    padding: 12px 20px 12px 50px;
    font-size: 1rem;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 0, 0, 0.2);
    color: white;
    transition: all 0.3s ease;
}

.search-wrapper input:focus {
    border-color: var(--accent-red);
    background: rgba(255, 0, 0, 0.05);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
}

.search-wrapper .search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-red);
    opacity: 0.8;
}

/* --- View Switcher --- */
.view-switcher-section {
    width: 100%;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.view-switcher-container {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 15px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.switcher-icons {
    display: flex;
    gap: 8px;
}

.switcher-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.switcher-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.switcher-btn.active {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
    box-shadow: 0 0 15px rgba(187, 10, 10, 0.3);
}

/* --- 3. The Grid --- */
.vault-grid-container {
    flex: 1;
    overflow-y: auto;
}

.vault-grid {
    display: grid;
    gap: 30px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enable View Transition Gliding for first 20 items */
@media (prefers-reduced-motion: no-preference) {
    .vault-item:nth-child(1) {
        view-transition-name: item-1;
    }

    .vault-item:nth-child(2) {
        view-transition-name: item-2;
    }

    .vault-item:nth-child(3) {
        view-transition-name: item-3;
    }

    .vault-item:nth-child(4) {
        view-transition-name: item-4;
    }

    .vault-item:nth-child(5) {
        view-transition-name: item-5;
    }

    .vault-item:nth-child(6) {
        view-transition-name: item-6;
    }

    .vault-item:nth-child(7) {
        view-transition-name: item-7;
    }

    .vault-item:nth-child(8) {
        view-transition-name: item-8;
    }

    .vault-item:nth-child(9) {
        view-transition-name: item-9;
    }

    .vault-item:nth-child(10) {
        view-transition-name: item-10;
    }

    .vault-item:nth-child(11) {
        view-transition-name: item-11;
    }

    .vault-item:nth-child(12) {
        view-transition-name: item-12;
    }

    .vault-item:nth-child(13) {
        view-transition-name: item-13;
    }

    .vault-item:nth-child(14) {
        view-transition-name: item-14;
    }

    .vault-item:nth-child(15) {
        view-transition-name: item-15;
    }

    .vault-item:nth-child(16) {
        view-transition-name: item-16;
    }

    .vault-item:nth-child(17) {
        view-transition-name: item-17;
    }

    .vault-item:nth-child(18) {
        view-transition-name: item-18;
    }

    .vault-item:nth-child(19) {
        view-transition-name: item-19;
    }

    .vault-item:nth-child(20) {
        view-transition-name: item-20;
    }

}

/* Specific view classes */
.vault-grid.grid-view-small {
    grid-template-columns: repeat(5, 1fr);
}

.vault-grid.grid-view-medium {
    grid-template-columns: repeat(3, 1fr);
}

.vault-grid.grid-view-big {
    grid-template-columns: repeat(2, 1fr);
}

.vault-item {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    min-width: 0;
    /* Critical for grid items to shrink below content size */
}

.vault-item:hover {
    transform: translateY(-5px);
}

.item-visual {
    aspect-ratio: 16/10;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 0, 0, 0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #000;
}

.vault-item:hover .item-visual {
    border-color: var(--accent-red);
    box-shadow: 0 0 20px rgba(187, 10, 10, 0.4), 0 8px 25px rgba(0, 0, 0, 0.4);
}

.item-visual img,
.item-visual .img-fit {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.4s ease;
}

.vault-item:hover .item-visual img,
.vault-item:hover .item-visual .img-fit {
    transform: scale(1.08);
}

.item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(187, 10, 10, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vault-item:hover .item-overlay {
    opacity: 1;
}

.play-button-icon {
    width: 50px;
    height: 50px;
    background: var(--accent-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 20px rgba(187, 10, 10, 0.5);
    transition: transform 0.3s ease;
    padding-left: 4px;
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.item-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.item-date {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
}

.session-duration-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 2;
    display: none;
}

/* Admin Controls */
.admin-item-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vault-item:hover .admin-item-controls {
    opacity: 1;
}

.admin-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* --- 4. Empty State --- */
.vault-empty-state {
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.2);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .vault-container {
        flex-direction: column;
        height: auto !important;
        /* Disable fixed height */
        min-height: auto;
        overflow: visible;
        margin-top: 60px;
        /* Adjust header offset for mobile */
    }

    .vault-sidebar {
        width: 100%;
        height: auto;
        padding: 15px;
        position: static;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .vault-grid-container {
        overflow-y: visible;
        /* Let document scroll */
        height: auto;
    }

    .vault-main {
        padding: 20px 15px;
        overflow: visible;
        /* Ensure content flows */
    }

    .sidebar-timeline {
        display: flex;
        overflow-x: auto;
        gap: 20px;
        padding-bottom: 10px;
    }

    .timeline-line {
        display: none;
    }

    .timeline-node {
        margin-bottom: 0;
        flex-shrink: 0;
    }
}

/* Mobile Grid Adjustments */
@media (max-width: 600px) {

    /* Hide grid view switcher on mobile to save space */
    .view-switcher-section {
        display: none !important;
    }

    .vault-grid {
        gap: 10px;
        /* Tighter gap for mobile */
    }

    /* Standard overrides for mobile requested 4/2/1 layout */
    .vault-grid.grid-view-small {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .vault-grid.grid-view-medium {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .vault-grid.grid-view-big {
        grid-template-columns: 1fr !important;
    }

    /* In 6-column mode, hide text info to keep it clean (Mosaic Mode) */
    .vault-grid.grid-view-small .item-info {
        display: none;
    }

    .vault-grid.grid-view-small .item-visual {
        margin-bottom: 0;
        border-radius: 4px;
    }
}