/* ===========================================
   THE RAT SHACK - Styles
   Light mode, elegant scrapbook meets data viz
   =========================================== */

:root {
    /* Light base */
    --bg-cream: #faf8f5;
    --bg-paper: #fffef9;
    
    /* Dark, rich timeline colors */
    --primary-dark: #1a1625;
    --purple-deep: #2d1b4e;
    --purple-mid: #4a2c7a;
    --purple-light: #7b5caa;
    --blue-accent: #3d5a80;
    --red-accent: #9d4452;
    --gold-accent: #c9a227;
    
    /* Ownership colors */
    --color-owned: #4a2c7a;
    --color-foster: #5a7a3d;
    --color-sanctuary: #9d4452;
    
    /* Text */
    --text-dark: #1a1625;
    --text-muted: #5a5466;
    --text-light: #faf8f5;
    
    /* Fonts */
    --font-display: 'Crimson Pro', Georgia, serif;
    --font-mono: 'Space Mono', monospace;
}

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

body {
    font-family: var(--font-display);
    background-color: var(--bg-cream);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
}

/* Background painting - low opacity watermark */
.background-painting {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.background-painting img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.4;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(45, 27, 78, 0.95), rgba(74, 44, 122, 0.9));
    border-radius: 12px;
    color: var(--text-light);
    box-shadow: 0 4px 20px rgba(26, 22, 37, 0.3);
}

.header-center {
    flex-shrink: 0;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex: 1;
}

.slideshow-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.slideshow-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Clean nav links */
.nav-item,
.nav-item:link,
.nav-item:visited {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
    padding: 0.25rem 0;
}

.nav-item:hover {
    color: #ffffff;
}

.nav-item.active {
    color: #ffffff;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gold-accent);
    border-radius: 1px;
}

/* Button styled as nav item */
.nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-btn:hover {
    color: #ffffff;
}

/* Header actions (slideshow, add buttons) */
.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Legacy nav-link for backwards compatibility */
.nav-link,
.nav-link:link,
.nav-link:visited {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #faf8f5 !important;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff !important;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header .subtitle {
    font-size: 0.9rem;
    font-style: italic;
    opacity: 0.9;
}

/* Timeline controls */
.timeline-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-paper);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(26, 22, 37, 0.1);
    border: 1px solid rgba(26, 22, 37, 0.1);
}

.filter-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Filter toggle (mobile) */
.filter-toggle {
    display: none;
    background: var(--purple-mid);
    color: var(--text-light);
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-toggle:hover {
    background: var(--purple-deep);
}

/* Zoom controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.zoom-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: bold;
}

.zoom-slider {
    width: 120px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--purple-light), var(--purple-mid));
    border-radius: 4px;
    cursor: pointer;
    touch-action: none; /* Allow slider to handle its own touch events */
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--purple-mid);
    border: 2px solid var(--bg-paper);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.zoom-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--purple-mid);
    border: 2px solid var(--bg-paper);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.zoom-slider:active::-webkit-slider-thumb {
    cursor: grabbing;
}

/* Larger touch target on mobile */
@media (pointer: coarse) {
    .zoom-slider {
        height: 12px;
    }
    
    .zoom-slider::-webkit-slider-thumb {
        width: 32px;
        height: 32px;
    }
    
    .zoom-slider::-moz-range-thumb {
        width: 32px;
        height: 32px;
    }
}

.zoom-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.filter-controls label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    transition: background 0.2s ease;
}

.filter-controls label:hover {
    background: rgba(74, 44, 122, 0.1);
}

.filter-controls label.filter-highlight {
    background: rgba(201, 162, 39, 0.15);
    border: 1px solid var(--gold-accent);
}

.filter-controls label.filter-highlight:hover {
    background: rgba(201, 162, 39, 0.25);
}

.filter-controls .filter-divider {
    color: var(--text-muted);
    opacity: 0.4;
    margin: 0 0.25rem;
}

.filter-controls input[type="checkbox"] {
    accent-color: var(--purple-mid);
    width: 16px;
    height: 16px;
}

.stats {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Timeline wrapper */
.timeline-wrapper {
    background: var(--bg-paper);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(26, 22, 37, 0.15);
    border: 1px solid rgba(26, 22, 37, 0.1);
    overflow: auto;
    /* Use dvh for mobile browser chrome awareness, with fallback */
    max-height: min(50vh, 450px);
    max-height: min(50dvh, 450px);
    position: relative;
    touch-action: pan-x pan-y; /* Allow normal scroll/pan on touch devices */
}

/* Custom scrollbars for timeline */
.timeline-wrapper::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.timeline-wrapper::-webkit-scrollbar-track {
    background: rgba(26, 22, 37, 0.05);
}

.timeline-wrapper::-webkit-scrollbar-thumb {
    background: var(--purple-light);
    border-radius: 6px;
}

.timeline-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--purple-mid);
}

.timeline-wrapper::-webkit-scrollbar-corner {
    background: rgba(26, 22, 37, 0.05);
}

/* Click and drag cursor states */
.timeline-wrapper {
    cursor: grab;
}

.timeline-wrapper.dragging {
    cursor: grabbing;
    user-select: none;
}

.timeline-wrapper .rat-bar {
    cursor: pointer;
}

/* Timeline */
.timeline {
    position: relative;
    padding: 0;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    font-size: 1.25rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Year markers - sticky header */
.year-markers {
    display: flex;
    position: sticky;
    top: 0;
    left: 0;
    height: 44px;
    border-bottom: 2px solid var(--primary-dark);
    background: var(--bg-paper);
    z-index: 20;
}

.year-marker {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
    padding-top: 0.75rem;
    border-left: 1px solid rgba(26, 22, 37, 0.2);
    box-sizing: border-box;
    background: var(--bg-paper);
}

.year-marker:first-child {
    border-left: none;
}

/* Month grid lines */
.month-grid {
    z-index: 1;
}

.month-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(26, 22, 37, 0.08);
}

.month-line.year-start {
    background: rgba(26, 22, 37, 0.25);
}

/* Rat Shack transition marker - hidden until we have second background */
.shack-transition {
    display: none;
}

/* Rat bars on timeline */
.rat-bar {
    position: absolute;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    overflow: visible;
}

.rat-bar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.rat-bar.owned { background: linear-gradient(135deg, var(--color-owned), #5d3a8e); }
.rat-bar.foster { background: linear-gradient(135deg, var(--color-foster), #6d944a); }
.rat-bar.sanctuary { background: linear-gradient(135deg, var(--color-sanctuary), #b35566); }

.rat-bar.currently-living {
    border: 2px solid var(--gold-accent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(201, 162, 39, 0.3);
}

.rat-bar .rat-bar-content {
    display: flex;
    align-items: center;
    transition: transform 0.05s ease-out;
}

.rat-bar .rat-photo-thumb {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.rat-bar .rat-label {
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-shadow: 0 0 2px rgba(0,0,0,0.9), 0 0 4px rgba(0,0,0,0.7);
    white-space: nowrap;
    overflow: visible;
}

/* Compact mode - hide text, shrink photos */
.rat-bar.compact {
    padding: 0 4px;
    border-radius: 3px;
}

.rat-bar.compact .rat-label {
    display: none;
}

.rat-bar.compact .rat-photo-thumb {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    margin-right: 0;
    border-width: 1px;
}

.rat-bar.compact .fire-badge {
    display: none;
}

/* Fire badge for Squidget */
.fire-badge {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 1.2rem;
}

/* Photo lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    cursor: zoom-out;
    padding: 2rem;
}

.lightbox.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* Header buttons */
.header-buttons {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    justify-content: flex-end;
}

.slideshow-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.25rem 0;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    font-family: inherit;
}

.slideshow-btn:hover {
    color: #ffffff;
}

/* Admin login button */
.admin-login-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-login-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.admin-login-btn.logged-in {
    background: rgba(255, 200, 100, 0.2);
    border-color: rgba(255, 200, 100, 0.4);
}

.admin-login-btn.authorized {
    background: rgba(100, 200, 100, 0.2);
    border-color: rgba(100, 200, 100, 0.4);
}

/* Photo slideshow overlay */
.slideshow-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    flex-direction: column;
}

.slideshow-overlay.active {
    display: flex;
}

.slideshow-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    transition: opacity 0.3s ease, background 0.2s ease;
    z-index: 10;
}

.slideshow-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.slideshow-controls {
    position: absolute;
    top: 1.5rem;
    right: 5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.75rem;
    border-radius: 30px;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.slideshow-controls button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: transform 0.2s ease;
}

.slideshow-controls button:hover {
    transform: scale(1.2);
}

#slideshow-speed {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    min-width: 40px;
    text-align: center;
}

.slideshow-overlay.hide-controls .slideshow-close,
.slideshow-overlay.hide-controls .slideshow-controls {
    opacity: 0;
    pointer-events: none;
}

.slideshow-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 4rem 2rem 7rem;
}

#slideshow-img {
    max-width: 85%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
    transition: opacity 0.75s ease, transform 0.75s ease;
}

#slideshow-img.fade-out {
    opacity: 0;
    transform: scale(0.95);
}

#slideshow-img.fade-in {
    opacity: 1;
    transform: scale(1);
}

.slideshow-info {
    margin-top: 2rem;
    text-align: center;
    color: white;
    transition: opacity 0.75s ease;
}

.slideshow-info.fade-out {
    opacity: 0;
}

.slideshow-info.fade-in {
    opacity: 1;
}

.slideshow-info .rat-name {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.slideshow-info .rat-dates {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Anniversaries section */
.anniversaries-section {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.anniversaries-today,
.anniversaries-upcoming {
    background: var(--bg-paper);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(26, 22, 37, 0.1);
    border: 1px solid rgba(26, 22, 37, 0.1);
}

.anniversaries-section h3 {
    font-size: 1.1rem;
    color: var(--purple-mid);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.anniversary-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.anniversary-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(26, 22, 37, 0.03);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.anniversary-item:hover {
    background: rgba(74, 44, 122, 0.1);
}

.anniversary-item .emoji {
    font-size: 1.25rem;
}

.anniversary-item .details {
    flex: 1;
}

.anniversary-item .rat-name {
    font-weight: 600;
    color: var(--text-dark);
}

.anniversary-item .anniversary-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.anniversary-item .date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(26, 22, 37, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.anniversary-item.birthday .emoji { color: #e91e63; }
.anniversary-item.gotcha .emoji { color: var(--gold-accent); }
.anniversary-item.remembrance .emoji { color: var(--purple-light); }

.no-anniversaries {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    header {
        padding: 0.75rem 1rem;
        margin-bottom: 0.5rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    header .subtitle {
        font-size: 0.85rem;
    }
    
    .timeline-controls {
        padding: 0.75rem;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .filter-controls {
        gap: 0.5rem 1rem;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .filter-controls label {
        font-size: 0.8rem;
        gap: 0.25rem;
    }
    
    .zoom-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .zoom-slider {
        width: 100px;
    }
    
    .zoom-label {
        font-size: 0.75rem;
    }
    
    .zoom-hint {
        display: none;
    }
    
    .timeline-stats {
        font-size: 0.75rem;
        text-align: center;
    }
    
    .filter-divider {
        display: none;
    }
    
    .rat-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .rat-photo-main {
        max-width: 200px;
        max-height: 200px;
    }
    
    .modal-content {
        padding: 1rem;
        max-height: 85vh;
    }
    
    .year-marker {
        font-size: 0.75rem;
        padding-top: 0.5rem;
    }
    
    .year-markers {
        height: 36px;
    }
    
    .anniversaries-section {
        grid-template-columns: 1fr;
    }
    
    #slideshow-img {
        max-height: 60vh;
    }
    
    .slideshow-content {
        padding: 3rem 1.5rem 5.5rem;
    }
    
    .slideshow-info .rat-name {
        font-size: 1.5rem;
    }
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        text-align: center;
    }
    
    header h1 {
        font-size: 1.4rem;
    }
    
    header .subtitle {
        font-size: 0.75rem;
    }
    
    .header-center {
        order: 0;
        width: 100%;
        flex: none;
    }
    
    .header-nav {
        order: 1;
        width: 100%;
        justify-content: center;
        gap: 0.5rem 1rem;
        flex-wrap: wrap;
        flex: none;
    }
    
    .nav-item {
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .slideshow-btn {
        order: 2;
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    
    .slideshow-content {
        padding: 3rem 1rem 5rem;
    }
    
    #slideshow-img {
        max-width: 95%;
        max-height: 55vh;
    }
    
    .slideshow-info {
        margin-top: 1rem;
    }
    
    .slideshow-info .rat-name {
        font-size: 1.25rem;
    }
    
    .slideshow-info .rat-dates {
        font-size: 0.75rem;
    }
    
    .slideshow-close {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        top: 1rem;
        right: 1rem;
    }
    
    .slideshow-controls {
        top: 1rem;
        right: 4rem;
        padding: 0.3rem 0.5rem;
        gap: 0.4rem;
    }
    
    .slideshow-controls button {
        font-size: 1.25rem;
    }
    
    #slideshow-speed {
        font-size: 0.75rem;
        min-width: 30px;
    }
    
    .filter-controls label {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }
    
    .filter-controls input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
    
    .timeline-stats {
        font-size: 0.65rem;
    }
    
    /* Filter toggle visible on small screens */
    .filter-toggle {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .filter-controls {
        display: none;
        width: 100%;
        padding: 0.5rem;
        background: rgba(74, 44, 122, 0.05);
        border-radius: 6px;
        margin-bottom: 0.5rem;
    }
    
    .filter-controls.expanded {
        display: flex;
    }
    
    .zoom-slider {
        width: 80px;
    }
}

/* ===========================================
   MY RATS / MY PHOTOS PAGE STYLES
   =========================================== */

/* Page Controls */
.page-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(26, 22, 37, 0.1);
}

.controls-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

.add-btn {
    background: var(--purple-mid);
    color: var(--text-light);
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.add-btn:hover {
    background: var(--purple-deep);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 44, 122, 0.3);
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 2px solid var(--purple-light);
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: var(--font-display);
    background: var(--bg-paper);
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--purple-mid);
    box-shadow: 0 0 0 3px rgba(123, 92, 170, 0.2);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.filter-pills {
    display: flex;
    gap: 0.5rem;
}

.pill {
    padding: 0.5rem 1rem;
    border: 2px solid var(--purple-light);
    border-radius: 20px;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-display);
    color: var(--purple-mid);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill:hover {
    background: rgba(123, 92, 170, 0.1);
}

.pill.active {
    background: var(--purple-mid);
    border-color: var(--purple-mid);
    color: var(--text-light);
}

.sort-control select {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--purple-light);
    border-radius: 8px;
    background: var(--bg-paper);
    font-size: 0.85rem;
    font-family: var(--font-display);
    color: var(--text-dark);
    cursor: pointer;
}

.sort-control select:focus {
    outline: none;
    border-color: var(--purple-mid);
}

.page-controls .stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Rats Page Sections */
.rats-section {
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--purple-primary);
}

.alumni-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.alumni-controls .filter-pills {
    margin: 0;
}

.alumni-controls .sort-control {
    margin-left: auto;
}

@media (max-width: 600px) {
    .alumni-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .alumni-controls .sort-control {
        margin-left: 0;
    }
}

/* Content Grid (for rat cards) */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.content-grid .loading,
.photos-list .loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-size: 1.1rem;
    font-style: italic;
}

/* Rat Card */
.rat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(26, 22, 37, 0.1);
    border: 2px solid transparent;
}

.rat-card:hover {
    border-color: var(--purple-light);
    box-shadow: 0 6px 20px rgba(26, 22, 37, 0.15);
    transform: translateY(-3px);
}

.rat-card-photo {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg-cream);
}

.rat-card-placeholder {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-cream), var(--bg-paper));
    font-size: 4rem;
}

.rat-card-body {
    padding: 1rem;
}

.rat-card-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.rat-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.rat-card-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-owned {
    background: rgba(74, 44, 122, 0.15);
    color: var(--purple-mid);
}

.badge-foster {
    background: rgba(90, 122, 61, 0.15);
    color: var(--color-foster);
}

.badge-sanctuary {
    background: rgba(157, 68, 82, 0.15);
    color: var(--color-sanctuary);
}

.badge-living {
    background: rgba(201, 162, 39, 0.2);
    color: #8b6914;
}

/* Photos List */
.photos-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.photo-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(26, 22, 37, 0.1);
    border: 2px solid transparent;
}

.photo-row:hover {
    border-color: var(--purple-light);
    background: rgba(255, 255, 255, 1);
}

.photo-row-thumb {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-cream);
}

.photo-row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-row-content {
    flex: 1;
    min-width: 0;
}

.photo-row-rats {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.photo-type-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
}

.photo-type-badge.group {
    background: rgba(201, 162, 39, 0.2);
    color: #8b6914;
}

.photo-type-badge.solo {
    background: rgba(74, 44, 122, 0.15);
    color: var(--purple-mid);
}

.photo-row-caption {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.photo-row-caption.empty {
    color: #aaa;
    font-style: normal;
}

.photo-row-date {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Detail Modal (for both rats and photos) */
.detail-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 22, 37, 0.7);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 200;
    padding: 2rem;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

.detail-modal-overlay.active {
    display: flex;
}

.detail-modal {
    background: var(--bg-paper);
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    margin: 2rem 0;
    position: relative;
    box-shadow: 0 20px 50px rgba(26, 22, 37, 0.3);
}

.detail-modal.coming-soon {
    max-width: 400px;
    text-align: center;
}

.detail-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-cream);
    color: var(--text-muted);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.detail-modal-close:hover {
    background: var(--purple-light);
    color: var(--text-light);
}

.detail-modal-content {
    padding: 2rem;
}

/* Modal Header */
.modal-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--bg-cream);
}

.modal-photo {
    flex-shrink: 0;
}

.modal-photo-main {
    width: 180px;
    height: 180px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--bg-cream);
}

.modal-photo-placeholder {
    width: 180px;
    height: 180px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--bg-cream), var(--bg-paper));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.modal-photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    max-width: 180px;
}

.modal-photo-gallery img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.modal-photo-gallery img:hover,
.modal-photo-gallery img.active {
    opacity: 1;
}

.modal-photo-gallery img.active {
    border-color: var(--purple-mid);
}

.modal-photo-gallery img.group-photo {
    border-color: var(--gold-accent);
}

.modal-photo-gallery img.group-photo.active {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.3);
}

.modal-info {
    flex: 1;
}

.modal-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.modal-fullname {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.modal-nicknames {
    font-size: 0.85rem;
    color: var(--purple-light);
    margin-bottom: 0.75rem;
}

.modal-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.modal-dates {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Detail Sections */
.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--purple-mid);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.detail-item {
    background: var(--bg-cream);
    padding: 0.75rem;
    border-radius: 8px;
}

.detail-item label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.detail-item span {
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* Collapsible Sections */
.collapsible-section .collapsible-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.collapsible-section .collapsible-header:hover {
    color: var(--purple-mid);
}

.collapsible-section .record-count {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}

.collapsible-section .collapse-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
    transition: transform 0.2s ease;
}

.collapsible-section .collapsible-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
}

/* Health Records Table */
.health-records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.health-records-table th {
    text-align: left;
    padding: 0.75rem;
    background: var(--bg-cream);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--purple-light);
}

.health-records-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--bg-cream);
    color: var(--text-dark);
}

.health-records-table tr:hover td {
    background: rgba(123, 92, 170, 0.05);
}

.record-type {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.record-type-vet {
    background: rgba(74, 44, 122, 0.15);
    color: var(--purple-mid);
}

.record-type-health {
    background: rgba(157, 68, 82, 0.15);
    color: var(--color-sanctuary);
}

.record-type-other {
    background: var(--bg-cream);
    color: var(--text-muted);
}

/* Personality Section */
.personality-content {
    background: var(--bg-cream);
    border-left: 4px solid var(--purple-mid);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
}

/* Buddies Display */
.buddies-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.buddy-tag {
    display: inline-flex;
    flex-direction: column;
    background: var(--bg-cream);
    border: 2px solid var(--purple-light);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.buddy-tag:hover {
    border-color: var(--purple-mid);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 44, 122, 0.15);
}

.buddy-tag-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.buddy-tag-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Notes Log Section (in edit modal) */
.notes-log {
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid rgba(74, 44, 122, 0.2);
    border-radius: 8px;
    background: var(--bg-paper);
    margin-bottom: 0.75rem;
}

.notes-log:empty::before {
    content: 'No notes yet';
    display: block;
    padding: 1rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.note-item {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(74, 44, 122, 0.1);
}

.note-item:last-child {
    border-bottom: none;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.note-title {
    font-weight: 600;
    color: var(--text-dark);
}

.note-actions {
    display: flex;
    gap: 0.25rem;
}

.note-edit,
.note-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.85rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.note-edit:hover {
    opacity: 1;
    color: var(--plum);
}

.note-delete:hover {
    opacity: 1;
    color: #c53030;
}

.note-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(74, 44, 122, 0.05);
    border-radius: 6px;
}

.note-edit-form input,
.note-edit-form textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(74, 44, 122, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--font-display);
}

.note-edit-form textarea {
    min-height: 60px;
    resize: vertical;
}

.edit-note-buttons {
    display: flex;
    gap: 0.5rem;
}

.note-content {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.4;
}

.add-note-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.add-note-form input,
.add-note-form textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(74, 44, 122, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--font-display);
}

.add-note-form textarea {
    min-height: 60px;
    resize: vertical;
}

.add-note-form button {
    align-self: flex-start;
}

/* Notes Display (in detail view) */
.notes-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-card {
    background: var(--bg-cream);
    border-left: 4px solid var(--gold-accent);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
}

.note-card-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.note-card-content {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.4;
}

/* Health Records Section (in edit modal) */
.health-log {
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid rgba(74, 44, 122, 0.2);
    border-radius: 8px;
    background: var(--bg-paper);
    margin-bottom: 0.75rem;
}

.health-log:empty::before {
    content: 'No health records yet';
    display: block;
    padding: 1rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.health-item {
    display: block;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(74, 44, 122, 0.1);
}

.health-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.health-item:last-child {
    border-bottom: none;
}

.health-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.health-event {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.health-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.health-edit,
.health-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.85rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.health-edit:hover {
    opacity: 1;
    color: var(--plum);
}

.health-delete:hover {
    opacity: 1;
    color: #c53030;
}

.health-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(74, 44, 122, 0.05);
    border-radius: 6px;
}

.health-edit-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.health-edit-form input[type="date"],
.health-edit-form input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(74, 44, 122, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--font-display);
}

.health-edit-form input[type="date"] {
    flex: 0 0 auto;
}

.health-edit-form input[type="text"] {
    flex: 1;
    min-width: 200px;
}

.edit-health-buttons {
    display: flex;
    gap: 0.5rem;
}

.add-health-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.health-form-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.health-form-row input[type="date"] {
    flex: 1;
    min-width: 140px;
}

.health-form-row input[type="text"] {
    flex: 2;
    min-width: 200px;
}

.add-health-form input {
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(74, 44, 122, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--font-display);
}

.add-health-form button {
    align-self: flex-start;
}

.approx-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.approx-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-purple);
}

.approx-checkbox span {
    font-weight: 600;
    color: var(--primary-purple);
}

.approx-date {
    font-style: italic;
    color: var(--text-muted);
}

/* Notes Section */
.notes-content {
    background: var(--bg-cream);
    border-left: 4px solid var(--gold-accent);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-emoji {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Coming Soon */
.coming-soon-content {
    padding: 2.5rem 2rem !important;
}

.coming-soon-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.coming-soon-content h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.coming-soon-content p {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.coming-soon-note {
    font-size: 0.85rem;
    color: var(--purple-light);
    margin-bottom: 1.5rem !important;
}

/* Add/Edit Forms */
.add-photo-modal {
    max-width: 500px;
}

.add-rat-modal {
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-divider {
    border: none;
    border-top: 1px solid rgba(26, 22, 37, 0.15);
    margin: 1.25rem 0 0.75rem 0;
}

.form-section-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0;
    font-style: italic;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(74, 44, 122, 0.2);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-display);
    background: var(--bg-paper);
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--purple-mid);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0.75rem 0;
}

.filter-input {
    margin-bottom: 0.75rem;
}

/* Buddies Section */
.buddies-list {
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid rgba(74, 44, 122, 0.2);
    border-radius: 8px;
    background: var(--bg-paper);
}

.buddy-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(74, 44, 122, 0.1);
}

.buddy-item:last-child {
    border-bottom: none;
}

.buddy-item.hidden {
    display: none;
}

.buddy-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-dark);
}

.buddy-options {
    display: flex;
    gap: 1rem;
}

.buddy-option {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.buddy-option input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.photo-upload-area {
    position: relative;
    border: 2px dashed rgba(74, 44, 122, 0.3);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(74, 44, 122, 0.03);
}

.photo-upload-area:hover {
    border-color: var(--purple-mid);
    background: rgba(74, 44, 122, 0.06);
}

.photo-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.upload-icon {
    font-size: 2rem;
}

.photo-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
}

.photo-upload-area.has-preview .upload-placeholder {
    display: none;
}

.rat-filter-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(74, 44, 122, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}

.rat-filter-input:focus {
    outline: none;
    border-color: var(--purple-mid);
}

.rat-filter-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.rat-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 2px solid rgba(74, 44, 122, 0.1);
    border-radius: 8px;
    background: rgba(74, 44, 122, 0.02);
}

.rat-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-paper);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.9rem;
}

.rat-checkbox:hover {
    background: rgba(74, 44, 122, 0.1);
}

.rat-checkbox input {
    accent-color: var(--purple-mid);
}

.rat-checkbox.checked {
    background: rgba(74, 44, 122, 0.15);
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(74, 44, 122, 0.1);
}

.btn-primary {
    padding: 0.6rem 1.25rem;
    background: var(--purple-mid);
    color: var(--text-light);
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--purple-deep);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-danger {
    padding: 0.6rem 1.25rem;
    background: var(--red-accent);
    color: var(--text-light);
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #7a3540;
}

.btn-secondary {
    padding: 0.6rem 1.25rem;
    background: var(--bg-cream);
    color: var(--text-dark);
    border: 2px solid var(--purple-light);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--purple-light);
    color: var(--text-light);
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 15px;
}

/* Photo Detail */
.photo-detail {
    text-align: center;
}

.photo-detail-image {
    max-width: 100%;
    max-height: 50vh;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.photo-detail-info {
    text-align: left;
}

.photo-detail-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.photo-detail-caption {
    color: var(--text-muted);
    font-style: italic;
    margin: 0.75rem 0;
}

.photo-detail-date {
    color: var(--purple-light);
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.photo-detail-tags {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--bg-cream);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    background: var(--bg-cream);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Modal Actions */
.modal-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--bg-cream);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Responsive for My Rats/Photos pages */
@media (max-width: 768px) {
    .page-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-pills {
        justify-content: center;
    }
    
    .modal-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .modal-photo-gallery {
        max-width: none;
        justify-content: center;
    }
    
    .modal-badges {
        justify-content: center;
    }
    
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .photo-row-date {
        display: none;
    }
}

/* Mobile: 2 rat cards per row */
@media (max-width: 520px) {
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .rat-card-photo,
    .rat-card-placeholder {
        height: 120px;
    }
    
    .rat-card-body {
        padding: 0.6rem;
    }
    
    .rat-card-name {
        font-size: 0.95rem;
    }
    
    .rat-card-meta {
        font-size: 0.7rem;
    }
    
    .rat-card-badges {
        gap: 0.25rem;
    }
    
    .rat-card-badges .badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .filter-pills {
        flex-wrap: wrap;
    }
    
    .pill {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }
    
    .photo-row {
        padding: 0.5rem 0.75rem;
        gap: 0.75rem;
    }
    
    .photo-row-thumb {
        width: 55px;
        height: 55px;
    }
    
    .photo-row-rats {
        font-size: 0.9rem;
        flex-wrap: wrap;
    }
}

/* ===========================================
   Footer
   =========================================== */

.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, rgba(45, 27, 78, 0.9), rgba(74, 44, 122, 0.85));
    border-radius: 12px;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--text-light);
}

.footer-admin {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}

.footer-admin:hover {
    color: rgba(255, 255, 255, 0.8);
}

.footer-admin.logged-in {
    color: rgba(255, 255, 255, 0.7);
}

.footer-admin.authorized {
    color: var(--gold-accent);
}

.footer-copy {
    color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 600px) {
    .site-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ===========================================
   Welcome Page (index.html)
   =========================================== */

.welcome-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem 2rem;
    box-sizing: border-box;
    margin: 0 auto;
}

.welcome-header {
    text-align: center;
    margin-bottom: 0.75rem;
}

.welcome-header h1 {
    font-family: var(--font-display);
    font-size: 2.75rem;
    font-weight: 700;
    color: var(--purple-deep);
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
    line-height: 1.1;
}

.welcome-header .subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.25rem;
}

.rat-emoji {
    display: inline-block;
}

.rat-emoji.flipped {
    transform: scaleX(-1);
}

.welcome-painting {
    width: min(600px, 90vw);
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    border: 4px solid var(--gold-accent);
    box-shadow: 0 8px 30px rgba(201, 162, 39, 0.3), 0 4px 20px rgba(26, 22, 37, 0.2);
}

.welcome-painting img {
    width: 100%;
    height: auto;
    display: block;
}

.welcome-nav {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1rem;
}

.welcome-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, rgba(45, 27, 78, 0.92), rgba(74, 44, 122, 0.88));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: var(--text-light);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 15px rgba(26, 22, 37, 0.25);
}

.welcome-nav-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 25px rgba(74, 44, 122, 0.4), 0 0 15px rgba(201, 162, 39, 0.2);
    border-color: var(--gold-accent);
    background: linear-gradient(135deg, rgba(65, 40, 100, 0.98), rgba(95, 60, 145, 0.95));
}

.welcome-nav-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(26, 22, 37, 0.3);
    transition: all 0.05s ease;
}

.welcome-nav-btn .icon {
    font-size: 1.2rem;
    transition: transform 0.15s ease;
}

.welcome-nav-btn:hover .icon {
    transform: scale(1.15);
}

/* Welcome page footer */
.welcome-footer {
    margin-top: 1rem;
    width: 100%;
    max-width: 500px;
}

@media (max-width: 600px) {
    .welcome-container {
        padding: 0.75rem 1rem;
    }
    
    .welcome-header {
        margin-bottom: 0.5rem;
    }
    
    .welcome-header h1 {
        font-size: 1.75rem;
        white-space: nowrap;
    }
    
    .welcome-header .subtitle {
        font-size: 0.9rem;
    }
    
    .welcome-painting {
        width: min(400px, 92vw);
        margin-bottom: 0.75rem;
    }
    
    .welcome-nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
        width: 100%;
        max-width: 280px;
        margin-bottom: 0.5rem;
    }
    
    .welcome-nav-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        border-radius: 50px;
        gap: 0.3rem;
        white-space: nowrap;
        justify-content: center;
    }
    
    .welcome-nav-btn .icon {
        font-size: 0.9rem;
    }
    
    .welcome-footer {
        padding: 0.75rem 1rem;
        margin-top: 0.5rem;
    }
}

@media (max-width: 380px) {
    .welcome-header h1 {
        font-size: 1.5rem;
    }
    
    .welcome-painting {
        width: 95vw;
    }
}

@media (max-height: 700px) {
    .welcome-painting {
        width: min(350px, 85vw);
        margin-bottom: 0.5rem;
    }
    
    .welcome-nav-btn {
        padding: 0.5rem 1rem;
    }
}

/* ===========================================
   FAQ Page Styles
   =========================================== */

.faq-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 0;
}

.faq-category {
    margin-bottom: 2.5rem;
}

.faq-category-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--purple-deep);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--purple-light);
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: rgba(255, 254, 249, 0.95);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(26, 22, 37, 0.1);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.faq-item:hover {
    box-shadow: 0 4px 16px rgba(26, 22, 37, 0.15);
}

.faq-item.faq-hidden {
    opacity: 0.6;
    border: 2px dashed var(--text-muted);
}

.faq-question {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    transition: background-color 0.2s ease;
}

.faq-question:hover {
    background: rgba(74, 44, 122, 0.05);
}

.faq-question-text {
    flex: 1;
}

.faq-hidden-badge {
    background: var(--text-muted);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.faq-toggle {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.faq-item.expanded .faq-toggle {
    transform: rotate(180deg);
}

.faq-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.faq-edit-btn:hover {
    opacity: 1;
}

.faq-answer {
    display: none;
    padding: 0 1.25rem 1.25rem 1.25rem;
    font-family: var(--font-display);
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-dark);
}

.faq-item.expanded .faq-answer {
    display: block;
}

.faq-answer a {
    color: var(--purple-mid);
    text-decoration: underline;
}

.faq-answer a:hover {
    color: var(--purple-deep);
}

.faq-answer strong {
    font-weight: 600;
}

/* FAQ Admin Section */
#add-faq-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 0;
    text-align: center;
}

#add-faq-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    background: var(--purple-mid);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 600;
    transition: background-color 0.2s ease;
}

#add-faq-btn:hover {
    background: var(--purple-deep);
}

/* FAQ Form Styles */
#faq-form .form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-style: italic;
}

#faq-form textarea {
    min-height: 150px;
    resize: vertical;
}

/* FAQ Responsive */
@media (max-width: 768px) {
    .faq-container {
        padding: 0.5rem;
    }
    
    .faq-category-title {
        font-size: 1.4rem;
    }
    
    .faq-question {
        font-size: 1rem;
        padding: 0.875rem 1rem;
    }
    
    .faq-answer {
        font-size: 0.95rem;
        padding: 0 1rem 1rem 1rem;
    }
}

/* ===========================================
   Connections Network Graph
   =========================================== */

.connections-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.connections-controls .filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.connections-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.legend-line {
    width: 30px;
    height: 4px;
    border-radius: 2px;
}

.legend-line.littermate-line {
    background: #ed8936;
    background: linear-gradient(90deg, #ed8936 0%, #ed8936 25%, transparent 25%, transparent 50%, #ed8936 50%, #ed8936 75%, transparent 75%, transparent 100%);
    background-size: 8px 4px;
}

.legend-line.cagemate-line {
    background: var(--purple-mid);
}

.legend-line.buddy-line {
    background: #48bb78;
    background: linear-gradient(90deg, #48bb78 0%, #48bb78 50%, transparent 50%, transparent 100%);
    background-size: 8px 4px;
}


.connections-container {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    padding: 1rem;
    padding-bottom: 0.5rem;
    margin-top: 1rem;
    box-shadow: 0 4px 24px rgba(74, 44, 122, 0.1);
    overflow: hidden;
}

.connections-graph {
    width: 100%;
    min-height: 500px;
    position: relative;
    padding-bottom: 1rem;
}

.connections-graph svg {
    display: block;
    width: 100%;
}

/* Links */
.link {
    stroke: var(--purple-light);
    stroke-width: 2px;
    stroke-linecap: round;
    stroke-opacity: 0.7;
}

.link-littermate {
    stroke: #ed8936;
    stroke-dasharray: 3, 3;
}

.link-cagemate {
    stroke: var(--purple-mid);
}

.link-buddy {
    stroke: #48bb78;
    stroke-dasharray: 6, 4;
}


.link.dimmed {
    stroke-opacity: 0.1;
}

.link.highlighted {
    stroke-opacity: 1;
    stroke-width: 4px !important;
}

/* Nodes */
.node {
    cursor: pointer;
    transition: opacity 0.2s;
}

.node.dimmed {
    opacity: 0.3;
}

.node-circle {
    fill: var(--bg-cream);
    stroke-width: 3px;
    transition: r 0.2s ease, stroke-width 0.2s ease;
}

.node-circle.living {
    stroke: var(--gold);
    filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.4));
}

.node-circle.alumni {
    stroke: var(--purple-light);
}

.node-label {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    fill: var(--text-dark);
    pointer-events: none;
    text-shadow: 
        1px 1px 0 rgba(255,255,255,0.8),
        -1px -1px 0 rgba(255,255,255,0.8),
        1px -1px 0 rgba(255,255,255,0.8),
        -1px 1px 0 rgba(255,255,255,0.8);
}

.node-emoji {
    pointer-events: none;
}

/* Tooltip */
.connection-tooltip {
    position: absolute;
    background: white;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1000;
    max-width: 200px;
}

.connection-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.connection-tooltip .tooltip-name {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.connection-tooltip .tooltip-name strong {
    font-weight: 600;
}

.connection-tooltip .tooltip-name .living-badge {
    font-size: 0.9rem;
}

.connection-tooltip .living-badge {
    margin-left: 0.25rem;
}

.connection-tooltip .tooltip-stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.connection-tooltip .tooltip-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

/* Empty state */
.connections-graph .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--text-muted);
}

.empty-message {
    font-family: var(--font-display);
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .connections-controls {
        padding: 0 0.5rem;
    }
    
    .connections-legend {
        gap: 0.75rem;
        font-size: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .legend-line {
        width: 16px;
    }
    
    .node-label {
        font-size: 10px;
    }
    
    /* Horizontal scroll wrapper for graph on mobile */
    .connections-graph {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .connections-graph svg {
        min-width: 900px; /* Force minimum width so graph isn't cramped */
    }
}

