/* =========================================
   PET SPACE - THE Yearbook CSS (SCRAPBOOK STYLE)
   ========================================= */

:root {
    --pet-gold: #FFB347;
    --pet-blue: #A2D2FF;
    --bg-cream: #FFFDF5;
    --card-white: #FFFFFF;
    --text-dark: #4A4A4A;
    --border-soft: #F0F0F0;
}

/* 0. GENERAL DEFAULTS */
body {
    background-color: var(--bg-cream) !important;
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    font-family: 'Quicksand', sans-serif;
}

/* 1. HEADER & NAVIGATION */
header { 
    width: 100%; 
    background: white !important; 
    display: block !important; 
}

#authItem { 
    display: flex; 
    align-items: center; 
}

.nav-user-info {
    display: flex;
    align-items: center;
}

.nav-pet-name {
    margin-right: 15px; 
    font-weight: 700; 
    color: var(--pet-gold);
}

.guest-login-link, .nav-link-simple {
    margin-right: 15px; 
    text-decoration: none; 
    color: #7a7a7a; 
    font-weight: 700;
}

.nav-btn, .logout-style {
    text-decoration: none;
}

/* 2. LAYOUT CONTROL */
.gallery-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: calc(100vh - 80px);
}

/* 3. SIDEBAR STYLING */
.archive-sidebar {
    border-right: 1px solid var(--border-soft);
    padding: 2rem;
    background: #FFF;
    height: 100vh;
    position: sticky;
    top: 0;
    box-sizing: border-box;
}

.sidebar-title {
    color: var(--pet-gold);
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.sidebar-subtitle {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 15px;
    padding-left: 10px;
}

/* 4. SEARCH BAR */
.search-container {
    margin-bottom: 20px;
}

#petSearch {
    width: 100%;
    padding: 12px 15px;
    border-radius: 25px;
    border: 2px solid var(--border-soft);
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    outline: none;
    transition: 0.3s;
    box-sizing: border-box;
}

#petSearch:focus {
    border-color: var(--pet-blue);
    box-shadow: 0 0 8px rgba(162, 210, 255, 0.4);
}

/* 5. FILTER BUTTONS & ARCHIVE NAV */
.timeline-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

button.filter-btn {
    all: unset !important; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 18px;
    border-radius: 50px;
    color: var(--text-dark);
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s ease;
    box-sizing: border-box;
    background: transparent;
}

button.filter-btn:hover, button.filter-btn.active {
    background: var(--pet-blue) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(162, 210, 255, 0.3);
}

.archive-count {
    font-size: 0.7rem;
    background: var(--pet-gold);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 10px;
}

button.active .archive-count {
    background: white;
    color: var(--pet-blue);
}

/* 6. PHOTO GRID */
.photo-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; 
    gap: 20px !important;
    padding: 2rem !important;
    align-content: start;
}

.no-photos-msg {
    color: #999; 
    padding: 20px; 
    text-align:center;
    grid-column: 1 / -1;
}

.photo-chip {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 100% !important; 
    overflow: hidden !important;
    background: white;
    border: 6px solid white; 
    border-radius: 4px; 
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.photo-chip:hover {
    transform: scale(1.03) rotate(1deg);
    z-index: 2;
}

.photo-chip img {
    position: absolute !important;
    top: 0; left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.chip-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    opacity: 0;
    transition: 0.3s;
}

.photo-chip:hover .chip-overlay {
    opacity: 1;
}

/* 7. LIGHTBOX & MODAL */
.lightbox {
    position: fixed !important; 
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.9); 
    display: none;
    justify-content: center !important;
    align-items: center !important;
    z-index: 99999 !important;
    backdrop-filter: blur(5px);
}

.lightbox.active { display: flex !important; }

.close-lightbox {
    position: fixed !important;
    top: 30px !important;
    right: 30px !important;
    background: white !important;
    color: black !important;
    border: none !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    font-size: 2.5rem !important;
    line-height: 1;
    cursor: pointer !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 100000 !important;
    transition: 0.2s ease;
}

.close-lightbox:hover {
    transform: scale(1.1);
    background: var(--pet-gold) !important;
    color: white !important;
}

.lightbox-content {
    max-width: 85%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox img {
    max-width: 100%;
    max-height: 75vh;
    border: 10px solid white;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    object-fit: contain;
}

.lightbox-info {
    margin-top: 20px;
    background: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    text-align: center;
}

.lightbox-pet-name {
    font-weight: 700; 
    color: var(--pet-gold);
}

.lightbox-saved-date {
    font-size: 0.8rem; 
    color: #999;
}

/* 8. MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .gallery-layout { 
        display: flex; 
        flex-direction: column; 
    }
    
    .archive-sidebar {
        width: 100%;
        height: auto;
        padding: 15px;
        position: sticky; 
        top: 0; 
        z-index: 100;
        border-bottom: 2px solid var(--border-soft);
    }

    .sidebar-subtitle, .sidebar-title { display: none; }

    .search-container {
        margin-bottom: 10px;
    }

    .timeline-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
    }

    .timeline-nav::-webkit-scrollbar {
        display: none;
    }

    button.filter-btn {
        width: auto !important;
        padding: 8px 15px !important;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    .photo-grid {
        grid-template-columns: repeat(2, 1fr) !important; 
        padding: 15px !important;
        gap: 15px !important;
    }

    .close-lightbox {
        top: 20px !important;
        right: 20px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.8rem !important;
    }
}