/* ============================================================
   TOP 1 PREMIUM STYLESHEET (Ultimate Edition)
   Crafted for Maximum Aesthetic and Usability
   ============================================================ */

:root {
    /* Premium Color Palette */
    --brand: #f97316;
    --brand-dark: #ea580c;
    --brand-soft: rgba(249, 115, 22, 0.08);
    --brand-glow: rgba(249, 115, 22, 0.4);
    
    --bg: #f4f4f5; /* Very subtle warm gray background */
    --surface: #ffffff;
    --surface-2: #fafafa;
    --surface-hover: #f1f5f9;
    
    --text-main: #09090b; /* Near black for high contrast */
    --text-secondary: #3f3f46;
    --text-muted: #71717a;
    
    --border: rgba(9, 9, 11, 0.08);
    --border-light: rgba(9, 9, 11, 0.04);
    
    /* Structural & Semantic Colors */
    --accent-blue: #3b82f6;
    --accent-blue-soft: rgba(59, 130, 246, 0.1);
    --accent-green: #10b981;
    --accent-red: #ef4444;
    
    /* Layout & Shaping */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    
    /* Premium Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 8px -2px rgba(0,0,0,0.05), 0 1px 4px -1px rgba(0,0,0,0.03);
    --shadow-md: 0 12px 24px -6px rgba(0,0,0,0.06), 0 4px 10px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 40px -8px rgba(0,0,0,0.08), 0 8px 16px -4px rgba(0,0,0,0.04);
    
    /* Motion */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================
   GLOBAL RESET & TYPOGRAPHY
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding-top: 80px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem; /* ~14.4px - Standard for social networks */
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

h1 { font-size: 1.5rem; } /* ~24px */
h2 { font-size: 1.35rem; } /* ~21px */
h3 { font-size: 1.2rem; } /* ~19px */
h4 { font-size: 1.1rem; } /* ~17.6px */
h5 { font-size: 1rem; } /* ~16px */
h6 { font-size: 0.9rem; } /* ~14.4px */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700; /* Slightly less heavy than 800 for better readability at smaller sizes */
    line-height: 1.25;
    margin-top: 0;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-normal);
}

.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* ============================================================
   NAVIGATION (GLASSMORPHISM)
   ============================================================ */
.top-nav {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    transition: var(--transition-normal);
}

.logo {
    font-size: 1.35rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 8px;
    transition: var(--transition-normal);
}

.menu-toggle:hover { transform: scale(1.05); }

/* ============================================================
   APP GRID LAYOUT
   ============================================================ */
.app-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 300px;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

.sidebar-menu, .right-panel {
    position: sticky;
    top: 100px;
    height: fit-content;
}

/* Сайдбар и мобильное меню */
.offcanvas {
    background-color: #ffffff !important;
    border-right: 1px solid rgba(0,0,0,0.05) !important;
}
.offcanvas-header {
    background-color: #f8fafc !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}
.menu-item {
    color: #475569 !important;
}
.menu-item:hover {
    background: #f1f5f9 !important;
    color: var(--brand) !important;
}
.sidebar-section-title {
    color: #94a3b8 !important;
    font-size: 0.7rem !important;
}

/* ЧАТ — Премиальная раскладка */
.messages-bubble {
    width: fit-content !important;
    max-width: 70% !important;
    padding: 10px 16px !important;
    border-radius: 20px !important;
    word-break: break-word;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.bubble-mine {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark)) !important;
    color: #fff !important;
    border-bottom-right-radius: 4px !important;
    margin-left: auto; /* Прижимает к правому краю */
}

.bubble-theirs {
    background: #ffffff !important;
    color: var(--text-main) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-bottom-left-radius: 4px !important;
    margin-right: auto; /* Прижимает к левому краю */
}

/* Уменьшение воздуха в ленте */
.card-body { padding: 1.25rem !important; }
.card-body .d-flex.gap-3.mb-3 { margin-bottom: 0.75rem !important; }
.post-text { margin-bottom: 1rem !important; line-height: 1.45; }

/* Поиск в шапке */
#userSearch {
    padding-left: 45px !important;
    padding-right: 15px !important;
    font-size: 0.85rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 40px;
}
.search-container i {
    left: 15px !important;
    opacity: 0.6;
}

/* Живой поиск — результаты */
.search-result-item {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.search-result-item:hover {
    background: #f8fafc;
}
.search-result-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.search-results-empty {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

.menu-item.active {
    background: var(--brand-soft, rgba(249, 115, 22, 0.08));
    color: var(--brand-dark, #ea580c);
    font-weight: 700;
}
.sidebar-section-title {
    margin: 20px 0 6px 14px;
    display: block;
    font-size: 0.7rem; /* Reduced from 0.75rem */
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* ============================================================
   CARDS & PANELS
   ============================================================ */
.card, .panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(9, 9, 11, 0.12);
}

.card-flush { padding: 0; }
.card-compact { padding: 16px 20px; }


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #f1f5f9; /* Light gray base */
    color: #334155;
    border: 1px solid rgba(0,0,0,0.05);
    padding: 8px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    color: #0f172a;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%) !important;
    color: #fff !important;
    border: none !important;
}

.btn-accent {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: #fff !important;
    border: none !important;
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text-main);
}

.btn-blue {
    background: var(--accent-blue);
    color: white;
}
.btn-blue:hover { background: #2563eb; }

.btn-light {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
}
.btn-light:hover {
    background: #e2e8f0 !important;
    color: var(--text-main) !important;
}
.btn-outline-primary {
    background: transparent !important;
    color: var(--brand) !important;
    border: 1.5px solid var(--brand) !important;
}
.btn-outline-primary:hover {
    background: var(--brand) !important;
    color: #fff !important;
}

/* Стилі для кнопок дій під постами */
.action-item {
    background: #f8fafc !important;
    color: #64748b !important;
    border: 1px solid rgba(0,0,0,0.03) !important;
    font-size: 0.8rem !important;
    padding: 6px 16px !important;
}
.action-item:hover {
    background: #f1f5f9 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.action-item.active-like {
    background: rgba(249, 115, 22, 0.1) !important;
    color: var(--brand) !important;
    border-color: rgba(249, 115, 22, 0.2) !important;
}

/* ============================================================
   УТИЛИТЫ И БАЗОВЫЕ ЭЛЕМЕНТЫ (UI Components)
   ============================================================ */

/* Курсоры и анимации наведения */
.cursor-pointer { cursor: pointer; }
.cursor-zoom-in { cursor: zoom-in; }
.transition-all { transition: all 0.25s ease-in-out; }

/* Пунктирная рамка для пустых блоков (Empty States) */
.border-dashed {
    border: 2px dashed var(--bs-border-color) !important;
}

/* Выравнивание шапки профиля на мобильных (если используется новая верстка) */
@media (max-width: 767.98px) {
    .profile-header-content {
        margin-top: 0;
        text-align: center;
        padding-top: 20px !important;
    }
}

/* ============================================================
   ЭЛЕМЕНТЫ ПОСТА (Post Components)
   ============================================================ */

/* Изображения в постах */
.post-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--bs-border-radius-xl);
    border: 1px solid var(--bs-border-color-translucent);
    margin-bottom: 20px;
    transition: filter 0.3s ease;
}
.post-image:hover {
    filter: brightness(0.9);
}

/* Кнопки действий (Лайк, Коммент) - Таблетки */
.action-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
    user-select: none;
}
.action-item:hover {
    background-color: var(--bs-gray-200) !important;
    transform: translateY(-2px);
}
.action-item.active-like {
    background-color: rgba(249, 115, 22, 0.1) !important; /* Легкий оранжевый фон */
    color: var(--bs-primary) !important;
    border-color: rgba(249, 115, 22, 0.2);
}

/* ============================================================
   ЖИВОЙ ПОИСК (Live Search Dropdown)
   ============================================================ */

.search-container {
    position: relative;
}

/* Сама панель с результатами */
.search-results {
    position: absolute;
    top: calc(100% + 10px); /* Отступ от инпута */
    left: 0;
    right: 0;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--bs-border-color, rgba(9, 9, 11, 0.08));
    z-index: 1050; /* Поверх всего контента */
    max-height: 350px;
    overflow-y: auto;
    padding: 8px;
    
    display: none; 
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.search-results.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Элемент списка (Один пользователь) */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--bs-body-color);
    text-decoration: none;
    border-radius: 10px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.search-result-item:hover {
    background-color: var(--bs-gray-100, #f1f5f9);
    color: var(--bs-primary);
}

.search-result-name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
}

.search-result-sub {
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #71717a);
    margin-top: 2px;
}

/* Состояние "Ничего не найдено" */
.search-results-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--bs-secondary-color, #71717a);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Кастомный скроллбар для выпадающего списка поиска */
.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
.search-results::-webkit-scrollbar-thumb { background: #e4e4e7; border-radius: 10px; }
.search-results::-webkit-scrollbar-thumb:hover { background: #d4d4d8; }



/* ============================================================
   ПРОФИЛЬ И ЛЕНТА (Unified Premium Styles)
   ============================================================ */

/* 1. Обложка профиля (Premium Look) */
.profile-cover {
    height: 280px;
    background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
    position: relative;
    overflow: hidden;
    border-radius: 24px 24px 0 0;
    transition: all 0.3s ease;
    z-index: 1; /* Создаем контекст наложения */
}

/* Добавляем легкий шум */
.profile-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.4;
    /* ИСПРАВЛЕНО: # заменен на %23 внутри url */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1; /* Шум строго под градиентом затемнения */
}

/* Затемнение снизу */
.profile-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, 
        rgba(15, 23, 42, 0.5) 0%, 
        rgba(15, 23, 42, 0.2) 30%, 
        transparent 100%);
    pointer-events: none;
    z-index: 1; /* Поверх шума и основного фона */
}

/* Эффект при наведении */
.profile-cover:hover {
    filter: brightness(0.95);
}

/* Адаптивность */
@media (max-width: 768px) {
    .profile-cover {
        height: 180px;
        border-radius: 0;
    }
}
/* 2. Контейнер шапки (расположен ниже обложки) */
.profile-header-content,
.profile-header {
    margin-top: 0;
    padding-top: 24px;
    position: relative;
    z-index: 10;
}

/* Если в HTML нет Bootstrap flex-классов, добавляем базовые отступы для старой версии */
.profile-header {
    padding: 0 32px 32px;
    display: flex;
    align-items: flex-end;
    gap: 24px;
}

/* 3. Аватар профиля "Squircle" (мягкий квадрат) */
.profile-avatar-wrapper > div,
.profile-avatar-wrapper > img,
.profile-avatar {
    width: 130px;
    height: 130px;
    border: 6px solid #ffffff !important;
    border-radius: 35% !important; /* Уникальная форма Squircle */
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    background-color: #ffffff;
    object-fit: cover;
    flex-shrink: 0;
}

/* 4. Информация профиля (для старой HTML-разметки) */
.profile-info {
    flex-grow: 1;
    padding-bottom: 8px;
}
.profile-info h1 {
    margin-bottom: 4px;
    font-size: 1.4rem; /* Reduced from 1.8rem */
    font-weight: 800;
    color: var(--bs-body-color, #09090b);
}

/* 5. Статистика профиля (для старой HTML-разметки) */
.main-content-container {
    margin-top: 32px;
    margin-bottom: 60px;
}

@media (max-width: 991.98px) {
    .main-content-container {
        margin-top: 16px;
        margin-bottom: 40px;
    }
}

.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    padding: 20px 32px;
    background: var(--bs-gray-100, #f8f9fa);
    border-top: 1px solid var(--bs-border-color-translucent, rgba(0,0,0,0.05));
}

.profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.stat-value {
    font-weight: 700;
    font-size: 1.1rem; /* Reduced from 1.25rem */
    color: var(--bs-body-color, #09090b);
    line-height: 1;
}
.stat-label {
    font-size: 0.7rem;
    color: var(--bs-secondary-color, #6c757d);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}


/* Контейнер аватара должен быть position: relative */
/* Контейнер аватара */
.profile-avatar-wrapper {
    display: inline-block;
    position: relative;
    /* Убеждаемся, что обертка соответствует размеру аватара */
    width: 130px; 
    height: 130px;
}

/* Базовый стиль точки Online */
.status-online {
    position: absolute;
    /* Идеальное позиционирование для формы Squircle (35% radius) */
    bottom: 5px; 
    right: 5px;
    width: 22px; /* Чуть увеличил для четкости */
    height: 22px;
    
    /* Сочный градиент вместо плоского цвета */
    background: linear-gradient(145deg, #22c55e, #16a34a); 
    
    /* Толстая обводка в цвет фона карточки/бордера аватара */
    border: 4px solid #ffffff; 
    border-radius: 50%;
    z-index: 15;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Эффект пульсации (улучшенное свечение) */
.status-online::after {
    content: '';
    position: absolute;
    inset: -4px; /* Равномерный отступ от центра */
    border-radius: 50%;
    border: 2px solid #22c55e;
    animation: online-pulse 2.5s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    opacity: 0;
}

@keyframes online-pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}
/* Стиль текста Online рядом с именем */
.badge-online {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #ecfdf5; /* Мягкий зеленый фон */
    color: #059669;
    padding: 3px 10px;
    border-radius: 50px; /* Полностью круглая плашка */
    font-weight: 800;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Маленькая точка внутри текстового бейджа */
.badge-online::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
}



/* ============================================================
   CUSTOM SCROLLBAR (Премиальный скролл)
   ============================================================ */


/* Утилиты для плавности и курсоров */
.transition-all { 
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); 
}
.cursor-pointer { 
    cursor: pointer; 
}

/* ============================================================
   GLOBAL LIGHTBOX (Premium Gallery)
   ============================================================ */
#global-gallery-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 20px;
}

#global-gallery-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.gallery-wrapper {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

#global-gallery-overlay.active .gallery-img.loaded {
    transform: scale(1);
    opacity: 1;
}

.gallery-close {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    z-index: 2010;
}

.gallery-close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

.gallery-save-btn {
    position: absolute;
    top: 30px;
    right: 84px; /* Рядом с кнопкой закрытия */
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    z-index: 2010;
    text-decoration: none;
}

.gallery-save-btn:hover {
    background: var(--brand);
    transform: translateY(-3px);
    color: white;
}

.gallery-nav {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 2010;
}

.nav-btn {
    width: 54px;
    height: 54px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-btn:hover {
    background: var(--brand);
    border-color: var(--brand);
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--brand-glow);
}

.nav-btn:active {
    transform: scale(0.9);
}

.gallery-caption {
    position: absolute;
    bottom: 30px;
    left: 0; right: 0;
    text-align: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.gallery-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: white;
    border-radius: 50%;
    animation: gallery-spin 0.8s linear infinite;
    position: absolute;
}

@keyframes gallery-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 767.98px) {
    .gallery-close { top: 20px; right: 20px; width: 36px; height: 36px; font-size: 1.5rem; }
}

/* ============================================================
   CHATS & MESSAGING
   ============================================================ */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 800px;
    margin-bottom: 0;
}

#chat-window {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    box-shadow: var(--shadow-xs);
    animation: message-appear 0.3s ease-out;
}

@keyframes message-appear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-mine {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-other {
    align-self: flex-start;
    background: #fff;
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-light);
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    z-index: 10;
}

.chat-footer {
    padding: 20px;
    background: #fff;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
    align-items: center;
}

@media (max-width: 767.98px) {
    .chat-container { height: 85vh; }
    #chat-window { padding: 16px; }
    .message { max-width: 90%; }
    .chat-header { padding: 12px 16px; }
    .chat-footer { padding: 12px; }
}

/* ============================================================
   RESPONSIVE DESIGN (Mobile & Tablet Adjustments)
   ============================================================ */

@media (max-width: 1199.98px) {
    .app-grid {
        grid-template-columns: 240px 1fr;
        gap: 20px;
    }
    .right-panel { display: none; }
}

@media (max-width: 991.98px) {
    body { padding-top: 70px; }

    .top-nav {
        padding: 0 16px;
        height: 60px;
    }

    .app-grid {
        grid-template-columns: 1fr;
        padding: 0 12px 40px;
    }

    .sidebar-menu { display: none; } /* Handled by offcanvas in Bootstrap */

    .profile-layout-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 16px 24px;
        gap: 16px;
        margin-top: 0;
    }

    .profile-info {
        width: 100%;
    }

    .profile-info h1 {
        font-size: 1.5rem;
    }

    .main-content-container {
    margin-top: 32px;
    margin-bottom: 60px;
}

@media (max-width: 991.98px) {
    .main-content-container {
        margin-top: 16px;
        margin-bottom: 40px;
    }
}

.profile-stats {
        justify-content: center;
        padding: 16px;
        gap: 20px;
    }

    .profile-stats > div:last-child {
        margin-left: 0 !important;
        text-align: center !important;
        width: 100%;
        border-top: 1px solid var(--border-light);
        padding-top: 12px;
    }

    .stat-item {
        align-items: center;
    }

    .profile-avatar-wrapper, .profile-avatar {
        width: 100px !important;
        height: 100px !important;
    }

    .profile-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        width: 100%;
        margin-top: 15px;
    }

    .profile-actions .btn {
        flex-grow: 1;
        justify-content: center;
    }

    .offcanvas-body .menu-item {
        padding: 14px 20px;
        font-size: 1rem;
        border-radius: 12px;
    }

    /* Buttons full width on mobile where it makes sense */
    .mobile-full-width {
        width: 100%;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 575.98px) {
    .card, .panel {
        border-radius: var(--radius-md);
        padding: 12px;
    }

    .post-image {
        border-radius: var(--radius-md);
        margin-bottom: 12px;
    }

    .logo {
        font-size: 1.1rem;
    }

    .action-item {
        font-size: 0.85rem;
        padding: 6px 10px;
    }

    .comments-section form {
        flex-wrap: wrap;
    }

    .comments-section form .form-input {
        width: 100%;
        order: 2;
    }

    .comments-section form .btn-icon {
        margin-left: auto;
        order: 1;
    }
}

/* Fix for profile-layout-grid when using inline styles */
.profile-layout-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
}

#scrollTop.show {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

#scrollTop:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 10px 20px var(--brand-glow) !important;
}

#scrollTop:active {
    transform: scale(0.95) !important;
}

@media (max-width: 767.98px) {
    #scrollTop {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: var(--transition-normal);
}

.form-input:focus {
    outline: none;
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 4px var(--brand-soft);
}
