/* General Reset and Base Styles from Epic Games Store */
html {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    background-color: rgb(16, 16, 20); /* Dark background */
}

*, ::before, ::after {
    box-sizing: inherit;
}

body {
    font-family: 'Inter', sans-serif; /* Epic's preferred font */
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    color: rgb(255, 255, 255); /* White text for dark background */
}

a {
    text-decoration: none;
    color: rgb(38, 187, 255); /* Epic's blue for links */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

a:hover {
    text-decoration: underline;
}

button {
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    appearance: none;
    background: rgba(0, 0, 0, 0);
    border-width: 0;
    cursor: pointer;
    margin: 0;
    padding: 0;
    text-align: left;
    font-weight: 400;
    color: inherit; /* Inherit text color */
}

input, label, select, button, textarea {
    margin: 0;
    border: 0;
    padding: 0;
    display: inline-block;
    vertical-align: middle;
    white-space: normal;
    background: none;
}

input {
    outline: 0;
}

input:not(:focus) {
    border-color: rgba(0, 0, 0, 0);
}

input::-webkit-input-placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

/* Custom Styles */
.navbar {
    background-color: rgb(24, 24, 28); /* Slightly darker than body */
    color: white;
    padding: 1em 20px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Distribute items */
    height: 4.5rem; /* Standard height from Epic's navigation */
    flex-wrap: nowrap; /* Prevent items from wrapping to a new line */
    position: relative; /* For absolute positioning of central button */
}

.branding-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between icon and text */
    flex-shrink: 0; /* Prevent branding from shrinking */
    position: relative; /* For positioning search input */
}

.branding-text {
    font-size: 1.2em;
    font-weight: 600;
    color: white;
    white-space: nowrap; /* Prevent text from wrapping */
}

.navbar .home-icon {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center; /* Center SVG within the icon area */
    width: 48px; /* Fixed width for the home icon area */
    height: 48px; /* Fixed height for the home icon area */
    border-radius: 4px;
    flex-shrink: 0; /* Prevent shrinking */
    padding: 0; /* Remove padding that was stretching it */
}

.navbar .home-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar .home-icon svg {
    fill: white; /* Ensure SVG fill is white */
    width: 24px;
    height: 24px;
}

/* New Search Input Container */
.search-input-container {
    position: absolute; /* Position relative to branding-container */
    right: -100px; /* Adjust this value to position it correctly */
    display: flex;
    align-items: center;
    height: 48px;
    overflow: hidden; /* Hide the expanded form initially */
    transition: width 0.3s ease-in-out;
    width: 48px; /* Initial width for just the icon */
}

.search-input-container:hover,
.search-input-container:focus-within {
    width: 300px; /* Expanded width on hover/focus */
}

.search-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background-color: transparent;
    transition: background-color 0.125s ease-in-out;
    flex-shrink: 0; /* Prevent shrinking */
}

.search-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.search-icon-btn svg {
    fill: white;
    width: 24px;
    height: 24px;
}

.expanded-search-form {
    display: flex;
    flex-grow: 1;
    height: 40px;
    background-color: rgb(32, 32, 36);
    border-radius: 24px;
    padding: 0 15px;
    margin-left: 10px; /* Space between icon and input */
    opacity: 0;
    pointer-events: none; /* Disable interaction when hidden */
    transition: opacity 0.3s ease-in-out;
}

.search-input-container:hover .expanded-search-form,
.search-input-container:focus-within .expanded-search-form {
    opacity: 1;
    pointer-events: auto; /* Enable interaction when visible */
}

.expanded-search-form input {
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    color: white;
    font-size: 1rem;
}

.expanded-search-form input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}


/* Achievements button, now central */
.achievements-central-btn {
    background-color: rgba(255, 255, 255, 0.1); /* Subtle background */
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.125s ease-in-out;
    flex-shrink: 0;
    position: absolute; /* Position absolutely within navbar */
    left: 50%;
    transform: translateX(-50%); /* Center horizontally */
}

.achievements-central-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}


/* Main Navigation Styles (only Games link remains) */
.main-nav {
    display: flex;
    align-items: center;
    margin-left: 20px; /* Space between central button and nav links */
    flex-shrink: 0; /* Prevent shrinking */
}

.main-nav a {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.5em 1em;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.125s ease-in-out, background-color 0.125s ease-in-out;
    border-radius: 4px;
}

.main-nav a:hover {
    color: rgb(255, 255, 255);
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

/* User Profile in Navbar */
.auth-container {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Prevent shrinking */
    margin-left: 20px; /* Space between main-nav and auth-container */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.profile-link {
    display: flex; /* Make the link content horizontal */
    align-items: center;
    gap: 10px;
    text-decoration: none; /* Remove underline from the link */
    color: white; /* Ensure the link text is white */
    transition: color 0.125s ease-in-out;
}

.profile-link:hover {
    text-decoration: none; /* Keep no underline on hover */
    color: rgba(255, 255, 255, 0.8); /* Slightly dim on hover */
}

.profile-bubble {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgb(95, 227, 103); /* Epic green */
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.1em;
    color: black; /* Text color for the bubble */
    flex-shrink: 0; /* Prevent bubble from shrinking */
}

.display-name {
    font-weight: 500;
    color: white; /* Explicitly set display name to white */
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background-color 0.125s ease-in-out;
    margin-left: 10px; /* Space between name and logout button */
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}


.container {
    display: flex;
    padding: 20px;
    max-width: 1200px;
    margin: auto;
    gap: 20px; /* Use gap for spacing */
}

.main-content {
    flex: 3;
    background-color: rgb(24, 24, 28); /* Darker background for content */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Subtle shadow */
}

.sidebar {
    flex: 1;
    background-color: rgb(24, 24, 28); /* Darker background for content */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Subtle shadow */
}

h2, h3 {
    color: rgb(255, 255, 255); /* White headings */
}

.news-item {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Lighter separator */
    padding-bottom: 15px;
}

.news-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.news-item h3 {
    color: rgb(38, 187, 255); /* Epic's blue for news titles */
}

.news-item p {
    color: rgba(255, 255, 255, 0.8); /* Slightly faded text */
}

.news-item small {
    color: rgba(255, 255, 255, 0.5); /* Even more faded for meta info */
}

.sidebar h3 {
    color: rgb(95, 227, 103); /* Epic's green for sidebar titles */
    margin-top: 0;
}

.game-list ul {
    list-style: none;
    padding: 0;
}

.game-list li {
    margin-bottom: 10px;
}

.game-list li a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8); /* Faded white for list items */
    transition: color 0.125s ease-in-out;
}

.game-list li a:hover {
    color: rgb(38, 187, 255); /* Epic's blue on hover */
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease-in-out;
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background-color: rgb(24, 24, 28);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease-in-out;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: color 0.125s ease-in-out;
}

.modal-close-btn:hover {
    color: rgb(255, 255, 255);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: rgb(255, 255, 255);
}

.epic-sign-in-btn {
    background-color: rgb(0, 120, 212); /* A distinct blue for Epic */
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.125s ease-in-out;
}

.epic-sign-in-btn:hover {
    background-color: rgb(0, 100, 180);
}

.epic-sign-in-btn svg {
    fill: white;
    width: 20px;
    height: 20px;
}

/* New styles for User Profile Page */
.profile-page-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: auto;
}

.user-profile-banner {
    position: relative;
    background-color: rgb(24, 24, 28);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    padding-bottom: 100px; /* Space for overlay content */
}

.user-profile-game-banner {
    height: 200px; /* Adjust as needed */
    background: url('https://via.placeholder.com/1200x200/1a1a1a/ffffff?text=User+Banner') no-repeat center center;
    background-size: cover;
    position: relative;
}

.profile-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 20px;
    background: linear-gradient(to top, rgba(18, 18, 20, 0.9), rgba(18, 18, 20, 0.7), transparent);
    gap: 20px;
}

.profile-bubble.large {
    width: 80px;
    height: 80px;
    font-size: 2.5em;
    flex-shrink: 0;
    border: 2px solid rgb(95, 227, 103); /* Green border for emphasis */
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-display-name {
    font-size: 2em;
    font-weight: 700;
    color: white;
    margin: 0;
}

.member-since {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 5px;
}

.profile-content-area {
    display: flex;
    gap: 20px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.user-feed-container {
    flex: 3;
    background-color: rgb(24, 24, 28);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    min-width: 300px; /* Ensure it doesn't get too small */
}

.feed-header {
    font-size: 1.5em;
    color: white;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.feed-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.stat-item {
    background-color: rgb(32, 32, 36);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 1.5em;
    font-weight: 700;
    color: rgb(95, 227, 103); /* Epic green */
}

.stat-label {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
}

.feed-items {
    /* Styles for individual feed items will go here */
}

.profile-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 250px; /* Ensure it doesn't get too small */
}

.sidebar-section {
    background-color: rgb(24, 24, 28);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
}

.sidebar-header {
    font-size: 1.2em;
    color: white;
    margin-top: 0;
    margin-bottom: 15px;
}

.sidebar-underline {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
}

/* Styles for create profile and not found */
.user-profile-create, .user-profile-not-found {
    background-color: rgb(24, 24, 28);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 40px;
    text-align: center;
    margin-top: 20px;
}

.user-profile-create h2, .user-profile-not-found h2 {
    color: rgb(255, 255, 255);
    margin-bottom: 15px;
}

.user-profile-create p, .user-profile-not-found p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
}

.create-profile-btn {
    background-color: rgb(95, 227, 103);
    color: black;
    padding: 12px 25px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.125s ease-in-out;
}

.create-profile-btn:hover {
    background-color: rgb(120, 240, 120);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .profile-page-container {
        flex-direction: column;
    }

    .profile-content-area {
        flex-direction: column;
    }

    .user-feed-container, .profile-sidebar {
        flex: none;
        width: 100%;
    }

    .profile-info-overlay {
        flex-direction: column;
        align-items: flex-start;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .user-display-name {
        font-size: 1.5em;
    }

    .profile-bubble.large {
        width: 60px;
        height: 60px;
        font-size: 2em;
    }
}