/* --- Base Variables and Styles --- */
/* CSS Variables for Colors and Dark Mode */
:root {
    /* Theme Color Base */
    --primary-color: #4f46e5; /* Indigo 600 */
    --primary-hover: #4338ca; /* Indigo 700 */
    --danger-color: #ef4444; /* Red 500 */
    --secondary-color: #6b7280; /* Gray 500 */
    
    /* Theme Variables (Light Mode Default) */
    --bg-default: #f9fafb; /* Gray 50 */
    --bg-paper: #ffffff; /* White */
    --bg-accent: #eef2ff; /* Indigo 50 */
    --border-default: #e5e7eb; /* Gray 200 */
    --text-default: #1f2937; /* Gray 800 */
    --text-heading: #111827; /* Gray 900 */
    --text-secondary: var(--secondary-color);
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-card-hover: 0 10px 20px rgba(0, 0, 0, 0.1);
    
    /* NEW: Media Viewer Background - White in light mode */
    --bg-media: #ffffff; 
}

html.dark:root {
    --bg-default: #111827; /* Gray 900 */
    --bg-paper: #1f2937; /* Gray 800 */
    --bg-accent: #3730a3; /* Indigo 800 (darker background accent) */
    --border-default: #374151; /* Gray 700 for border */
    --text-default: #e5e7eb; /* Gray 200 */
    --text-heading: #f3f4f6; /* Gray 100 */
    --text-secondary: #9ca3af; /* Gray 400 */
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 10px 20px rgba(0, 0, 0, 0.5);
    /* Ensure the primary color is still visible against dark backgrounds */
    --primary-color: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    
    /* NEW: Media Viewer Background - Black in dark mode */
    --bg-media: #000000; 
}

body {
    background-color: var(--bg-default);
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    color: var(--text-default);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s, color 0.3s; /* Smooth transition */
}

/* Hide Scrollbar for WebKit browsers on the profile view */
#profile-view {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    scroll-behavior: smooth;
    background-color: var(--bg-paper);
}
#profile-view::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Author Card Styles --- */
.author-card {
    background-color: var(--bg-paper);
    border-radius: 1rem;
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    border: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.author-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.card-content {
    padding: 1rem;
    display: block; 
    text-align: left;
}

/* Card style for the combined PFP + Text block (side-by-side, with border) */
.card-header-flex {
    display: flex; 
    align-items: center;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-default);
    border-radius: 0.75rem;
    background-color: var(--bg-accent);
}

.author-avatar {
    width: 7rem;
    height: 7rem;
    border-radius: 9999px;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.card-info-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

.card-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 0.125rem;
}

.card-id {
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 0;
}

.card-bio {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    height: 3rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 1rem;
}

.btn-view-profile {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.btn-view-profile:hover {
    background-color: var(--primary-hover);
}

/* --- Profile View (Full Screen Overlay) Styles --- */
#profile-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-default); /* Use dynamic background */
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: scroll;
}

#profile-view.is-active {
    transform: translateX(0);
}

.profile-header {
    position: sticky;
    top: 0;
    background-color: var(--bg-paper); /* Use dynamic paper background */
    border-bottom: 1px solid var(--border-default);
    padding: 1rem;
    box-shadow: var(--shadow-card);
    z-index: 10;
}

.back-button {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease;
    font-size: 1rem;
}

.back-button:hover {
    color: var(--primary-hover);
}

#profile-content {
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
    padding: 2rem 1rem;
}

/* New combined header styles for the profile view */
.profile-top-wrapper {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-default);
    text-align: center; 
}

.profile-main-info-block { 
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    border: 2px solid var(--primary-color);
    border-radius: 1.5rem;
    background-color: var(--bg-accent);
    text-align: center;
    margin: 0 auto;
}

.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1.5rem;
}

.profile-avatar {
    width: 18rem;
    height: 18rem;
    border-radius: 9999px;
    object-fit: cover;
    border: 4px solid var(--primary-color);
    box-shadow: var(--shadow-card-hover);
    flex-shrink: 0;
}

.profile-name {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-heading);
}

.profile-id, .profile-date {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}
.profile-id {
    color: var(--primary-hover);
    font-weight: 500;
}

/* Description Box */
.profile-bio-box {
    background-color: var(--bg-paper);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 3rem;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-card);
}

.profile-text {
    color: var(--text-default);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Single Image Viewer Styles */
.image-viewer-container {
    border-radius: 1rem;
    box-shadow: var(--shadow-card-hover);
    height: 20rem; 
    position: relative;
    /* Use the new dynamic media background variable */
    background-color: var(--bg-media); 
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
}

#single-image-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#current-media-image {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    cursor: pointer;
}

.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    padding: 0.75rem;
    border-radius: 9999px;
    color: white;
    transition: background-color 0.3s ease;
    z-index: 20;
    border: none;
    cursor: pointer;
    display: flex; 
}
.carousel-nav-btn:hover { background-color: rgba(0, 0, 0, 0.7); }
#prev-image { left: 1rem; }
#next-image { right: 1rem; }

.no-images-message {
    text-align: center;
    padding: 3rem;
    background-color: var(--border-default);
    color: var(--text-default);
    border-radius: 1rem;
}

/* Modal Styles remain the same */
#image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.98);
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
}

#image-modal.is-active { display: flex; }

#close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 70;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* Media Queries for Responsiveness */
@media (min-width: 768px) {
    
    /* Profile View Desktop Adjustments */
    .profile-main-info-block {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        padding: 3rem;
    }
    
    .profile-info {
        align-items: flex-start;
        margin-top: 0;
        margin-left: 3rem;
    }

    .author-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .author-list {
        grid-template-columns: repeat(2, 1fr);
    }
}
