/* CSS Variables for easy customization */
:root {
    --primary-color: #007bff; /* A vibrant blue for accents */
    --primary-light: #e6f2ff; /* Lighter shade for hover/backgrounds */
    --secondary-color: #6c757d; /* Grey for secondary text/elements */
    --background-color: #f0f2f5; /* Light grey background, common in social UIs */
    --card-background: #ffffff; /* White for content cards */
    --border-color: #e0e6ed; /* Light grey for subtle borders */
    --text-color-dark: #222; /* Dark grey for main text */
    --text-color-medium: #555; /* Medium grey for secondary text */
    --text-color-light: #888; /* Lighter grey for timestamps/small text */
    --success-color: #28a745; /* Green for success/positive actions */
    --error-color: #dc3545; /* Red for alerts/badges */

    --font-family: 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; /* Modern sans-serif stack */
    --border-radius-card: 12px; /* More rounded corners for cards */
    --border-radius-button: 25px; /* Pill shape for main buttons */
    --border-radius-small: 8px; /* Slightly less rounded for inputs/small elements */
    --spacing-unit: 16px; /* Base spacing unit */
}

/* Universal Box-Sizing */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Body and Base Typography */
body {
    font-family: var(--font-family);
    /* background-color: var(--background-color); */
    color: var(--text-color-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased; /* Smoother fonts on WebKit */
    -moz-osx-font-smoothing: grayscale; /* Smoother fonts on Firefox */
}

/* Container for Centering and Max-Width */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

/* Links Styling */
a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: var(--primary-color);
    filter: brightness(1.1); /* Slightly brighter on hover */
}

/* Card Base Style (for sidebars and posts) */
.card {
    background-color: var(--card-background);
    border-radius: var(--border-radius-card);
    padding: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); /* Subtle shadow for depth */
}

/* --- Header Styling --- */
.main-header {
    background-color: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-unit) / 2 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: sticky; /* Sticky header */
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-unit);
}

.logo {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-right: var(--spacing-unit);
}

.search-bar {
	height: 5vh;
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--background-color);
    border-radius: var(--border-radius-button);
    padding: 8px 15px;
    width: 250px; /* Fixed width for desktop */
}

.search-bar i {
    color: var(--text-color-light);
    margin-right: 8px;
}

.search-bar input {
	height: 5vh;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
    color: var(--text-color-dark);
    width: calc(100% - 25px); /* Adjust width for icon */
}

.search-bar input::placeholder {
    color: var(--text-color-light);
}

.header-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
}

.header-nav li {
    margin-left: var(--spacing-unit);
    position: relative; /* For badge positioning */
}

.header-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Circular buttons */
    color: var(--text-color-medium);
    font-size: 1.2rem;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.header-nav a:hover,
.header-nav a.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.badge {
    background-color: var(--error-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    font-weight: 600;
}

/* Avatar Styles */
.avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.avatar-medium {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    padding: 2px; /* Creates a nice border effect */
    margin-bottom: var(--spacing-unit) / 2;
}

/* --- Header Dropdown Styling --- */
.dropdown {
    position: relative;
    /* The li element already has position: relative from .header-nav li */
}

.dropdown-content {
    display: none; /* Hidden by default */
    position: absolute;
    background-color: var(--card-background);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: var(--border-radius-small);
    right: 0; /* Align dropdown to the right of the avatar */
    top: 100%; /* FIX: Position directly below the parent li, removing the gap */
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    padding: 8px 0;
}

.dropdown-content a {
    color: var(--text-color-dark);
    padding: 12px 16px;
    text-decoration: none;
    display: flex; /* Use flex to align icon and text */
    align-items: center;
    text-align: left;
    font-size: 0.95rem;
    transition: background-color 0.2s ease-in-out;
    border-radius: 0; /* Remove border-radius from individual links */
    width: 100%; /* Ensure links take full width */
    height: auto; /* Reset height from circular buttons */
}

.dropdown-content a i {
    margin-right: 10px; /* Space between icon and text */
    color: var(--secondary-color); /* Default icon color */
}

.dropdown-content a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.dropdown-content a:hover i {
    color: var(--primary-color); /* Icon color on hover */
}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}


/* --- Main Layout Grid --- */
.main-layout {
    display: grid;
    grid-template-columns: 1.2fr 2.5fr 1fr; /* Left, Center, Right columns */
    gap: var(--spacing-unit) * 1.5;
    padding: var(--spacing-unit) * 1.5 0;
    align-items: start; /* Align items to the top of their grid cells */
}

/* --- Left Sidebar --- */
.left-sidebar {
    margin-right: 3%;
    position: sticky; /* Make sidebar sticky */
    top: calc(var(--spacing-unit) + 60px); /* Adjust based on header height */
    align-self: flex-start; /* Ensure it sticks to the top */
}

.profile-summary {
    text-align: center;
    padding-bottom: var(--spacing-unit);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-unit);
}

.profile-summary h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--text-color-dark);
}

.profile-summary .profile-bio {
    color: var(--text-color-medium);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-unit);
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
    font-size: 0.95rem;
    color: var(--text-color-medium);
}

.profile-stats strong {
    font-size: 1.05rem;
    color: var(--text-color-dark);
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--border-radius-small);
    color: var(--text-color-dark);
    font-weight: 500;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.sidebar-nav a i {
    margin-right: 10px;
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-nav a:hover i,
.sidebar-nav a.active i {
    color: var(--primary-color);
}

/* --- Right Sidebar --- */
.right-sidebar {
    margin-left: 3%;
    position: sticky; /* Make sidebar sticky */
    top: calc(var(--spacing-unit) + 60px); /* Adjust based on header height */
    align-self: flex-start; /* Ensure it sticks to the top */
}

.card h3 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-unit);
    color: var(--text-color-dark);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-unit) / 2;
}

.suggestions ul, .trends ul {
    list-style: none;
}

.suggestions li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.suggestions li:last-child {
    margin-bottom: 0;
}

.suggestion-info {
    flex-grow: 1;
    margin-left: 10px;
    display: flex;
    flex-direction: column;
}

.suggestion-info span:first-child {
    font-weight: 500;
    color: var(--text-color-dark);
}

.suggestion-info .suggestion-mutual {
    font-size: 0.8rem;
    color: var(--text-color-light);
}

.trends li {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--text-color-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trends li:last-child {
    margin-bottom: 0;
}

.trends li .trend-count {
    color: var(--text-color-light);
    font-size: 0.85rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-button);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-out, box-shadow 0.2s ease-in-out;
    font-weight: 600;
    white-space: nowrap; /* Prevent text wrapping */
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-color);
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
}

.btn-secondary {
    background-color: var(--background-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 20px;
}

.btn-full-width {
    width: 100%;
    margin-top: var(--spacing-unit);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-color-medium);
    padding: 8px;
    font-size: 1.1rem;
    border-radius: 50%;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.btn-icon:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

/* --- Create Post Section --- */
.create-post {
    margin-top: 5.5%;
    display: flex;
    flex-direction: column;
    margin-bottom: var(--spacing-unit) * 1.5;
}

.create-post-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-unit) / 2;
}

.create-post-header .avatar-medium {
    margin-right: var(--spacing-unit);
}

.create-post textarea {
    flex-grow: 1;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-button); /* Pill shape for input */
    padding: 12px 18px;
    font-family: var(--font-family);
    font-size: 1rem;
    min-height: 50px; /* Minimum height for the input */
    resize: vertical; /* Allow vertical resizing */
    outline: none;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.create-post textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.create-post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-unit) / 2;
    border-top: 1px solid var(--border-color);
    margin-top: var(--spacing-unit);
}

.create-post-actions .btn-icon {
    margin-right: var(--spacing-unit) / 2;
    font-size: 1rem;
    padding: 10px;
}

.create-post-actions .post-button {
    margin-left: auto; /* Pushes the post button to the right */
}

/* --- Post Card Styling --- */
.post-card {
    margin-top: 3%;
    margin: 3%;
    margin-bottom: var(--spacing-unit) * 1.5;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-unit);
    position: relative;
}

.post-header .avatar-medium {
    margin-right: var(--spacing-unit) / 2;
}

.post-info {
    flex-grow: 1;
}

.post-info h4 {
    font-size: 1rem;
    margin: 0;
    color: var(--text-color-dark);
    font-weight: 600;
}

.post-info .timestamp {
    font-size: 0.8rem;
    color: var(--text-color-light);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- Dropdown Styling --- */
.dropdown {
    position: relative;
    /* The li element already has position: relative from .header-nav li */
}

.dropdown-content {
    display: none; /* Hidden by default */
    position: absolute;
    background-color: var(--card-background);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: var(--border-radius-small);
    right: 0; /* Align dropdown to the right of the avatar */
    top: 100%; /* FIX: Position directly below the parent li, removing the gap */
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    padding: 8px 0;
}

.dropdown-content a {
    color: var(--text-color-dark);
    padding: 12px 16px;
    text-decoration: none;
    display: flex; /* Use flex to align icon and text */
    align-items: center;
    text-align: left;
    font-size: 0.95rem;
    transition: background-color 0.2s ease-in-out;
    border-radius: 0; /* Remove border-radius from individual links */
    width: 100%; /* Ensure links take full width */
    height: auto; /* Reset height from circular buttons */
}

.dropdown-content a i {
    margin-right: 10px; /* Space between icon and text */
    color: var(--secondary-color); /* Default icon color */
}

.dropdown-content a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.dropdown-content a:hover i {
    color: var(--primary-color); /* Icon color on hover */
}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.post-options {
    background: none;
    border: none;
    color: var(--text-color-light);
    font-size: 1.1rem;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.post-options:hover {
    background-color: var(--background-color);
    color: var(--text-color-dark);
}

.post-content {
    margin-bottom: var(--spacing-unit);
}

.post-content p {
    margin-bottom: var(--spacing-unit);
    color: var(--text-color-dark);
}

.post-image {
    max-width: 100%;
    border-radius: var(--border-radius-small);
    display: block; /* Remove extra space below image */
    height: auto;
    object-fit: cover;
}

.post-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--spacing-unit) / 2;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-unit) / 2;
    font-size: 0.85rem;
    color: var(--text-color-medium);
}

.post-stats span i {
    margin-right: 5px;
    color: var(--primary-color);
}

.post-actions {
    display: flex;
    justify-content: space-around;
}

.post-actions .btn-action {
    flex: 1;
    text-align: center;
    color: var(--text-color-medium);
    font-size: 0.9rem;
    background: none;
    border: none;
    padding: 10px 5px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.post-actions .btn-action i {
    margin-right: 5px;
}

.post-actions .btn-action:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

/* --- Responsive Design --- */

/* Tablet and smaller desktops (992px and below) */
@media (max-width: 992px) {
    .main-layout {
        grid-template-columns: 1.5fr 3fr; /* Hide right sidebar */
        gap: var(--spacing-unit);
    }

    .right-sidebar {
        display: none; /* Hide the right sidebar */
    }

    .header-left {
        width: 100%;
        justify-content: space-between;
        margin-bottom: var(--spacing-unit) / 2;
    }

    .search-bar {
        flex-grow: 1; /* Allow search bar to take available space */
        width: auto;
    }

    .header-nav {
        width: 100%;
        order: 3; /* Move nav below search on smaller screens */
        margin-top: var(--spacing-unit) / 2;
    }

    .header-nav ul {
        justify-content: space-around;
        width: 100%;
    }

    .header-nav li {
        margin: 0;
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
    .main-header {
        padding: var(--spacing-unit) / 2;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-unit) / 2;
        margin-bottom: var(--spacing-unit);
    }

    .logo {
        margin-right: 0;
        margin-bottom: var(--spacing-unit) / 2;
    }

    .search-bar {
        width: 100%; /* Full width on mobile */
    }

    .main-layout {
        grid-template-columns: 1fr; /* Stack all columns */
        padding: var(--spacing-unit);
    }

    .left-sidebar {
        order: 2; /* Move left sidebar below main feed */
        position: static; /* Remove sticky behavior on mobile */
        margin-top: var(--spacing-unit);
    }

    .content-feed {
        order: 1; /* Main feed first */
    }

    .create-post-actions {
        flex-wrap: wrap; /* Allow buttons to wrap */
        justify-content: flex-start;
    }

    .create-post-actions .btn-icon {
        margin-bottom: 10px;
    }

    .create-post-actions .post-button {
        width: 100%;
        margin-left: 0;
    }

    /* FIX: Make post-actions horizontal on mobile */
    .post-actions {
        flex-direction: row; /* Change to row to display horizontally */
        justify-content: space-around; /* Distribute space evenly */
        gap: 5px; /* Add a small gap between buttons */
    }

    .post-actions .btn-action {
        flex: 1; /* Allow buttons to grow and share space */
        width: auto; /* Remove fixed width */
        padding: 10px 5px; /* Ensure consistent padding */
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-unit) / 2; /* Reduce horizontal padding */
    }

    .main-header {
        padding: 8px 0;
    }

    .header-nav a {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .profile-summary h3 {
        font-size: 1.1rem;
    }

    .profile-stats {
        flex-direction: column;
        gap: 5px;
    }

    .create-post textarea {
        min-height: 40px;
        padding: 10px 15px;
    }
	
	.dropdown {
    position: relative;
    /* The li element already has position: relative from .header-nav li */
}

.dropdown-content {
    display: none; /* Hidden by default */
    position: absolute;
    background-color: var(--card-background);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: var(--border-radius-small);
    right: 0; /* Align dropdown to the right of the avatar */
    top: 100%; /* FIX: Position directly below the parent li, removing the gap */
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    padding: 8px 0;
}

.dropdown-content a {
    color: var(--text-color-dark);
    padding: 12px 16px;
    text-decoration: none;
    display: flex; /* Use flex to align icon and text */
    align-items: center;
    text-align: left;
    font-size: 0.95rem;
    transition: background-color 0.2s ease-in-out;
    border-radius: 0; /* Remove border-radius from individual links */
    width: 100%; /* Ensure links take full width */
    height: auto; /* Reset height from circular buttons */
}

.dropdown-content a i {
    margin-right: 10px; /* Space between icon and text */
    color: var(--secondary-color); /* Default icon color */
}

.dropdown-content a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.dropdown-content a:hover i {
    color: var(--primary-color); /* Icon color on hover */
}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
}