/* --- DESIGN SYSTEM & CSS VARIABLES --- */
:root {
    --bg-main: #0b0f19;
    --bg-darker: #070a10;
    --card-bg: rgba(17, 24, 39, 0.7);
    --card-hover: rgba(31, 41, 55, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(139, 92, 246, 0.3);
    
    --primary: #8b5cf6;
    --primary-hover: #a78bfa;
    --secondary: #ec4899;
    --secondary-hover: #f472b6;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --glass-blur: blur(12px);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.12) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- LAYOUT STRUCTURE --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 3rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-icon {
    font-size: 1.8rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-item a svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: var(--transition);
}

.nav-item a:hover, .nav-item.active a {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary);
}

.nav-item.active a svg {
    color: var(--primary);
    filter: drop-shadow(0 0 5px rgba(139, 92, 246, 0.5));
}

.user-badge {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.user-badge-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.user-badge-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-badge-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-badge-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: 280px;
    padding: 2rem 3rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
}

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

/* --- ALERTS & NOTIFICATIONS --- */
.messages-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    background: rgba(17, 24, 39, 0.9);
    border-left: 4px solid var(--primary);
    backdrop-filter: var(--glass-blur);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
}

.alert-success { border-left-color: var(--success); }
.alert-error { border-left-color: var(--error); }
.alert-warning { border-left-color: var(--warning); }

.alert-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
}

.alert-close:hover {
    color: var(--text-primary);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 50%;
}

/* --- CARDS & GLASSMORPHISM --- */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: var(--card-hover);
}

/* --- AUTH PAGES (LOGIN / REGISTER) --- */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.18) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 45%);
}

.auth-card {
    width: 100%;
    max-width: 480px;
    padding: 3rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* --- FORMS & INPUTS --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-input, .form-select {
    width: 100%;
    padding: 0.85rem 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.form-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-file-input {
    width: 100%;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
}

/* --- SOCIAL FEED SYSTEM --- */
.feed-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.feed-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.create-post-card {
    display: flex;
    gap: 15px;
}

.create-post-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.create-post-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

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

/* Feed Posts */
.post-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.post-author-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.post-author-name {
    font-weight: 700;
    font-size: 1rem;
}

.post-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.post-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
}

/* Post Actions (Likes, Comments) */
.card-actions {
    display: flex;
    gap: 1.5rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    margin-top: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.action-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: var(--transition);
}

.action-btn:hover {
    color: var(--primary);
}

.action-btn.active {
    color: var(--secondary);
}

.action-btn.active svg {
    fill: var(--secondary);
    stroke: var(--secondary);
}

/* Comments Section */
.comments-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

.comment-item {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.comment-author {
    font-weight: 700;
    font-size: 0.85rem;
}

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

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.comment-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.comment-input {
    flex: 1;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
}

.comment-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* --- FLATS LISTINGS SYSTEM --- */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.flat-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.flat-image-wrapper {
    position: relative;
    height: 200px;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.flat-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.flat-card:hover .flat-image {
    transform: scale(1.05);
}

.flat-price-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: var(--glass-blur);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    border: 1px solid var(--border-color);
    color: #ffffff;
}

.flat-card-body {
    padding: 1.25rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.flat-room-type {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 1px;
}

.flat-title {
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.flat-location {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.flat-location svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.flat-specs {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.25rem 0;
}

.flat-spec-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.flat-amenities-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0.25rem 0;
}

.amenity-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
}

/* Flats Filter Panel */
.filter-sidebar {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-title {
    font-weight: 700;
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.amenities-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* --- FLAT DETAILS PAGE --- */
.details-container {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 3rem;
}

.details-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.details-image-gallery {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
    height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.gallery-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-sub-grid {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    height: 100%;
}

.gallery-sub-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.details-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.details-rent-period {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.details-section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.map-wrapper {
    height: 300px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Owner Side Card */
.details-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.owner-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.owner-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

/* --- ROOMMATES DIRECTORY --- */
.roommates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.roommate-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

.roommate-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.roommate-card:hover .roommate-avatar {
    transform: scale(1.05);
    border-color: var(--secondary);
}

.roommate-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.roommate-occupation {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.roommate-preferences {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 1.5rem;
}

.pref-badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    font-weight: 600;
}

.pref-badge.secondary {
    background: rgba(236, 72, 153, 0.1);
    color: var(--secondary);
    border-color: rgba(236, 72, 153, 0.2);
}

.roommate-budget {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* --- PROFILE PAGE --- */
.profile-header-card {
    display: flex;
    gap: 2.5rem;
    align-items: center;
    padding: 2.5rem;
    margin-bottom: 2.5rem;
}

.profile-avatar-large {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.profile-meta-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-name {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
}

.profile-social-counts {
    display: flex;
    gap: 20px;
    margin: 0.5rem 0;
}

.social-count-item {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.social-count-item strong {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.profile-tabs-wrapper {
    margin-bottom: 2rem;
}

.profile-tabs {
    display: flex;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
}

.profile-tab {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.profile-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* --- INBOX & CHAT WORKSPACE --- */
.chat-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    height: calc(100vh - 160px);
    align-items: stretch;
}

/* Inbox Sidebar Threads */
.inbox-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding-right: 5px;
}

.thread-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.thread-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-color);
}

.thread-card.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.2);
}

.thread-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.thread-info {
    flex: 1;
    min-width: 0;
}

.thread-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3px;
}

.thread-name {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.thread-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.thread-snippet {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.thread-unread-badge {
    background: var(--secondary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

.nav-unread-badge {
    background: var(--secondary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    position: absolute;
    top: 10px;
    right: 15px;
}

/* Chat Workspace Main Window */
.chat-window {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    height: 100%;
}

.chat-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.msg-bubble-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.msg-bubble-wrapper.sent {
    align-self: flex-end;
    align-items: flex-end;
}

.msg-bubble-wrapper.received {
    align-self: flex-start;
    align-items: flex-start;
}

.msg-bubble {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.5;
}

.msg-bubble-wrapper.sent .msg-bubble {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    border-bottom-right-radius: 2px;
}

.msg-bubble-wrapper.received .msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 2px;
}

.msg-timestamp {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.chat-input-bar {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-text-input {
    flex: 1;
    padding: 0.85rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.chat-text-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

/* --- ANIMATIONS --- */
@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- RESPONSIVE DESIGNS --- */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 2rem 0.5rem;
        align-items: center;
    }
    .logo-container span, .nav-item a span, .user-badge-info, .currency-selector-container {
        display: none;
    }
    .main-wrapper {
        margin-left: 80px;
        padding: 1.5rem;
    }
    .logo-container {
        justify-content: center;
        margin-bottom: 2rem;
    }
    .nav-item a {
        justify-content: center;
        padding: 1rem;
    }
    .details-container {
        grid-template-columns: 1fr;
    }
    .feed-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .inbox-sidebar {
        max-height: 250px;
    }
}

/* --- MAP THEME FILTER DEFAULTS --- */
.map-wrapper, #explore-map {
    filter: invert(90%) hue-rotate(180deg) brightness(95%) contrast(90%);
    transition: var(--transition);
}

/* --- LIGHT MODE THEME OVERRIDES --- */
[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-darker: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-hover: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-glow: rgba(124, 58, 237, 0.15);
    
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --secondary: #db2777;
    --secondary-hover: #be185d;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
}

/* Light mode body background glow */
[data-theme="light"] body {
    background-image: 
        radial-gradient(at 0% 0%, rgba(124, 58, 237, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(219, 39, 119, 0.06) 0px, transparent 50%);
}

/* Light mode Map tiles filter reset */
[data-theme="light"] .map-wrapper, [data-theme="light"] #explore-map {
    filter: none !important;
}

/* Button style tweaks for light mode */
[data-theme="light"] .btn-secondary {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
}
[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Scrollbar tweaks */
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Popups theme styling tweaks for light mode map */
[data-theme="light"] .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(0,0,0,0.08);
}
[data-theme="light"] .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0,0,0,0.08);
}

/* Trust & Moderation Warning Cards */
.broker-warning-card {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-top: 6px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #fca5a5;
    max-width: 100%;
}
.broker-warning-card strong {
    color: #f87171;
    display: block;
    margin-bottom: 4px;
}
.broker-warning-card p {
    margin: 0;
}
.broker-warning-card em {
    background: rgba(239, 68, 68, 0.2);
    padding: 1px 4px;
    border-radius: 3px;
    font-style: normal;
    font-weight: 600;
}

.flagged-user-chat-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #fde68a;
    display: flex;
    flex-direction: column;
    gap: 6px;
    backdrop-filter: var(--glass-blur);
}
.flagged-user-chat-warning strong {
    color: #fbbf24;
    font-size: 0.95rem;
}

/* Light mode adjustments for warning card */
[data-theme="light"] .broker-warning-card {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}
[data-theme="light"] .broker-warning-card strong {
    color: #991b1b;
}
[data-theme="light"] .broker-warning-card em {
    background: rgba(239, 68, 68, 0.1);
}
[data-theme="light"] .flagged-user-chat-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #92400e;
}
[data-theme="light"] .flagged-user-chat-warning strong {
    color: #b45309;
}

/* Modal Overlay Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: var(--glass-blur);
    animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Real-time chat bubble entrance animation */
@keyframes msgPopIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.msg-bubble-wrapper.new-msg {
    animation: msgPopIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: bottom right;
}

.msg-bubble-wrapper.new-msg.received {
    transform-origin: bottom left;
}

/* Mobile Navigation & Feed Optimizations */
.mobile-bottom-nav {
    display: none;
}
.mobile-more-menu {
    display: none;
}

@media (max-width: 768px) {
    /* Hide desktop sidebar */
    .sidebar {
        display: none !important;
    }
    
    /* Reset main content wrapper */
    .main-wrapper {
        margin-left: 0 !important;
        padding: 1rem 0.75rem 5.5rem 0.75rem !important; /* Bottom padding to avoid overlap with bottom nav */
    }
    
    /* Adjust top-header */
    .top-header {
        margin-bottom: 1.5rem !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    .mobile-logo-header {
        display: flex !important;
        align-items: center;
        gap: 6px;
        font-size: 1.25rem;
        font-weight: 800;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    
    .top-header .page-title {
        display: none !important; /* Hide page title on small screens to keep top header clean and clear */
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .mobile-actions {
        display: flex !important;
    }
    
    /* Mobile Bottom Navigation Bar */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: rgba(15, 23, 42, 0.9); /* slate-900 transparent */
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border-color);
        justify-content: space-around;
        align-items: center;
        z-index: 999;
        padding: 5px 0;
    }
    
    [data-theme="light"] .mobile-bottom-nav {
        background: rgba(248, 250, 252, 0.9); /* light mode bg main transparent */
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        text-decoration: none;
        background: none;
        border: none;
        padding: 4px 8px;
        font-family: inherit;
        cursor: pointer;
        transition: var(--transition);
        position: relative;
        flex: 1;
    }
    
    .mobile-nav-item svg {
        width: 22px;
        height: 22px;
        fill: currentColor;
        transition: var(--transition);
        opacity: 0.8;
    }
    
    .mobile-nav-item span {
        font-size: 0.65rem;
        font-weight: 500;
        margin-top: 2px;
    }
    
    .mobile-nav-item:hover, .mobile-nav-item.active {
        color: var(--primary);
    }
    
    .mobile-nav-item.active svg {
        fill: var(--primary);
        opacity: 1;
    }
    
    /* Mobile More Overlay Menu */
    .mobile-more-menu {
        position: fixed;
        bottom: -100%;
        left: 0;
        width: 100%;
        height: auto;
        max-height: 80vh;
        background: var(--bg-darker);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.3);
        padding: 1.5rem;
        overflow-y: auto;
        display: block !important;
    }
    
    .mobile-more-menu.active {
        bottom: 0;
    }
    
    .mobile-more-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.25rem;
    }
    
    .mobile-more-menu-header h3 {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--text-primary);
        margin: 0;
    }
    
    .mobile-more-menu-header button {
        background: none;
        border: none;
        color: var(--text-secondary);
        font-size: 1.8rem;
        cursor: pointer;
        padding: 0;
        line-height: 1;
    }
    
    .menu-user-badge {
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        color: inherit;
        padding: 0.5rem 0;
    }
    
    .menu-user-badge img, .menu-avatar-fallback {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        object-fit: cover;
    }
    
    .menu-avatar-fallback {
        background: var(--primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        color: white;
    }
    
    .menu-user-badge h4 {
        font-weight: 700;
        color: var(--text-primary);
        font-size: 0.95rem;
    }
    
    .menu-user-badge span {
        font-size: 0.75rem;
        color: var(--text-secondary);
    }
    
    .menu-divider {
        border: 0;
        border-top: 1px solid var(--border-color);
        margin: 1rem 0;
    }
    
    .menu-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 0.5rem;
        color: var(--text-secondary);
        text-decoration: none;
        font-weight: 600;
        font-size: 0.9rem;
        border-radius: var(--radius-sm);
        transition: var(--transition);
    }
    
    .menu-link:hover, .menu-link.active {
        color: var(--primary);
        background: rgba(255, 255, 255, 0.02);
    }
    
    .menu-badge {
        background: var(--secondary);
        color: white;
        font-size: 0.7rem;
        padding: 2px 6px;
        border-radius: 10px;
        font-weight: 700;
    }
    
    .menu-settings-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
        color: var(--text-secondary);
        font-weight: 600;
    }
    
    .menu-settings-row select {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        padding: 4px 8px;
        border-radius: var(--radius-sm);
        font-family: inherit;
        outline: none;
    }
    
    .menu-theme-btn {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        padding: 4px 12px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        font-family: inherit;
        font-size: 0.8rem;
        font-weight: 600;
    }
    
    .menu-logout {
        color: var(--secondary);
    }
    
    .menu-logout:hover {
        background: rgba(219, 39, 119, 0.05) !important;
        color: var(--secondary-hover);
    }

    /* Glass card padding and element spacing in feed on mobile */
    .glass-card {
        padding: 1.1rem !important;
    }
    
    .create-post-card {
        gap: 10px !important;
    }
    
    .create-post-avatar {
        width: 38px !important;
        height: 38px !important;
    }
    
    .create-post-form {
        gap: 0.75rem !important;
    }
    
    .create-post-form textarea {
        padding: 0.5rem !important;
        font-size: 0.9rem !important;
    }
    
    .post-actions-row {
        padding-top: 0.5rem !important;
    }
    
    .file-input-btn {
        font-size: 0.8rem !important;
    }
    
    .post-card {
        gap: 0.75rem !important;
    }
    
    .post-author-avatar {
        width: 38px !important;
        height: 38px !important;
    }
    
    .post-author-name {
        font-size: 0.9rem !important;
    }
    
    .post-time {
        font-size: 0.75rem !important;
    }
    
    .post-content {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
    }
    
    .post-image {
        max-height: 250px !important;
        margin-top: 0.25rem !important;
    }
    
    .card-actions {
        gap: 1rem !important;
        padding: 0.5rem 0 !important;
        margin-top: 0.25rem !important;
    }
    
    .action-btn {
        font-size: 0.8rem !important;
        gap: 6px !important;
    }
    
    .action-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    .comments-section {
        gap: 0.75rem !important;
        margin-top: 0.25rem !important;
    }
    
    .comments-list {
        gap: 0.5rem !important;
        max-height: 200px !important;
    }
    
    .comment-item {
        gap: 8px !important;
        padding: 0.5rem !important;
    }
    
    .comment-avatar {
        width: 26px !important;
        height: 26px !important;
    }
    
    .comment-author {
        font-size: 0.8rem !important;
    }
    
    .comment-content {
        font-size: 0.8rem !important;
    }
    
    .comment-time {
        font-size: 0.7rem !important;
    }
    
    .comment-form {
        gap: 8px !important;
    }
    
    .comment-input {
        padding: 0.5rem 0.85rem !important;
        font-size: 0.8rem !important;
    }
    
    .comment-form button {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.8rem !important;
    }
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.msg-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.9); /* slate-900 */
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    text-decoration: none;
    transform: translateX(120%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 320px;
    cursor: pointer;
}
.msg-toast.show {
    transform: translateX(0);
}
.msg-toast-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.msg-toast-avatar-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
}
.msg-toast-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.msg-toast-sender {
    font-weight: 700;
    font-size: 0.85rem;
}
.msg-toast-content {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}




