/**
 * БІЗДІҢ ӘЛЕМІМІЗ / НАШ МИР (OUR WORLD)
 * Master Style Sheet & Theme Variables
 */

:root {
    /* Тёмная тема (по умолчанию - романтическая глубина) */
    --bg-primary: #0d0f18;
    --bg-secondary: #161526;
    --bg-surface: rgba(26, 23, 42, 0.65);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-hover: rgba(255, 255, 255, 0.09);
    --border-glass: rgba(255, 255, 255, 0.12);
    --border-glass-glow: rgba(255, 105, 180, 0.35);

    --text-primary: #fcfbfe;
    --text-secondary: #a9a3be;
    --text-muted: #787195;

    --accent-pink: #ff4d79;
    --accent-rose: #ff7597;
    --accent-lavender: #b388ff;
    --accent-gold: #ffd166;
    --accent-gradient: linear-gradient(135deg, #ff4d79 0%, #b388ff 100%);
    --accent-gradient-hover: linear-gradient(135deg, #ff658d 0%, #c49eff 100%);

    --badge-draft: rgba(148, 163, 184, 0.2);
    --badge-sent: rgba(56, 189, 248, 0.2);
    --badge-opened: rgba(52, 211, 153, 0.2);
    --badge-replied: rgba(244, 114, 182, 0.25);
    --badge-unlocked: rgba(251, 191, 36, 0.25);

    --shadow-soft: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 25px rgba(255, 77, 121, 0.28);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    --transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #fff0f3;
    --bg-secondary: #ffe4e9;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --bg-glass-hover: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(255, 182, 193, 0.35);
    --border-glass-glow: rgba(255, 77, 121, 0.4);

    --text-primary: #2d1822;
    --text-secondary: #6e505e;
    --text-muted: #9c7a8b;

    --shadow-soft: 0 8px 30px 0 rgba(230, 100, 130, 0.12);
    --shadow-glow: 0 0 25px rgba(255, 77, 121, 0.2);
}

/* Global Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background Canvas & Ambient Blobs */
#romantic-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

.ambient-blob-1, .ambient-blob-2 {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

.ambient-blob-1 {
    top: -10vw;
    left: -10vw;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, #ff4d79, transparent 70%);
}

.ambient-blob-2 {
    bottom: -10vw;
    right: -10vw;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, #b388ff, transparent 70%);
}

/* Main App Wrapper */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    height: 70px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.brand-heart-icon {
    font-size: 1.75rem;
    filter: drop-shadow(0 0 8px rgba(255, 77, 121, 0.6));
    animation: gentlePulse 2.5s infinite ease-in-out;
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

/* Language Switcher */
.lang-switch-box {
    display: flex;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    padding: 2px;
}

.lang-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn.active {
    background: var(--accent-gradient);
    color: #fff;
}

/* User Badge */
.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    font-size: 0.85rem;
    font-weight: 500;
}

.user-avatar {
    font-size: 1.1rem;
}

.badge-role {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-full);
    background: rgba(255, 77, 121, 0.2);
    color: var(--accent-rose);
    font-weight: 700;
}

/* Icon Buttons */
.btn-icon-header {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    font-size: 1rem;
}

.btn-icon-header:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-glow);
    transform: translateY(-2px);
}

.notification-count {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--accent-pink);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: 0 0 8px rgba(255, 77, 121, 0.8);
    animation: heartPulse 1.8s infinite;
}

/* Main Layout: Desktop Sidebar + Content */
.main-wrapper {
    flex: 1;
    display: flex;
    max-width: 1380px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* Sidebar */
.desktop-sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: fit-content;
    position: sticky;
    top: 90px;
}

.nav-item-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.nav-item-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    transform: translateX(4px);
    border-color: var(--border-glass-glow);
}

.nav-item-btn.active {
    background: var(--accent-gradient);
    color: #ffffff;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
    font-weight: 600;
}

/* Content Area */
.content-area {
    flex: 1;
    min-width: 0;
}

/* Welcome Box */
.welcome-banner {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.welcome-text h2 {
    font-size: 1.35rem;
    font-weight: 700;
}

.partner-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.partner-badge {
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    background: rgba(255, 77, 121, 0.15);
    color: var(--accent-pink);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Filter and Search Bar */
.filter-search-container {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-input-wrap {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--accent-pink);
    box-shadow: 0 0 15px rgba(255, 77, 121, 0.25);
}

/* Category Filter Chips */
.category-chips-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.category-chips-bar::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    flex-shrink: 0;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-chip:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--accent-pink);
    color: #fff;
    border-color: var(--accent-pink);
    box-shadow: 0 0 12px rgba(255, 77, 121, 0.35);
}

/* Message Grid */
.messages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1.25rem;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.mobile-nav-btn span.nav-icon {
    font-size: 1.25rem;
}

.mobile-nav-btn.active {
    color: var(--accent-pink);
}

.mobile-nav-btn.active span.nav-icon {
    transform: scale(1.15);
}

/* Responsive Media Queries */
@media (max-width: 900px) {
    .desktop-sidebar {
        display: none;
    }
    .mobile-bottom-nav {
        display: flex;
    }
    .main-wrapper {
        padding: 1rem;
        padding-bottom: 80px; /* Отступ для bottom nav */
    }
    .messages-grid {
        grid-template-columns: 1fr;
    }
}
