/* stories-styles.css */
:root {
    --primary: #D63384;
    --primary-light: #F8BBD9;
    --primary-gradient: linear-gradient(135deg, #D63384, #E91E63);
    --secondary: #5A5A5A;
    --light-bg: #FDF8F8;
    --message-user: linear-gradient(135deg, #D63384, #E91E63);
    --message-partner: #e2256e24;
    --text-dark: #4A4A4A;
    --text-light: #8E8E93;
    --shadow: 0 2px 12px rgba(214, 51, 132, 0.1);
    --border-radius: 18px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--light-bg);
    color: var(--text-dark);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Кастомный скроллбар */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #F5F5F5;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Скрыть скрол для поля ввода */
.chat-input::-webkit-scrollbar {
    display: none;
}

.chat-input {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ФИКСИРОВАННАЯ ШАПКА */
.header {
    background: var(--primary-gradient);
    padding: 12px 16px;
    display: flex;
    justify-content: center;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    color: white;
    min-height: 60px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.logo {
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    font-size: 1.5rem;
}

.logo a {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo a:hover {
    opacity: 0.8;
}

/* Десктопное меню */
.desktop-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    margin: 0 auto;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    opacity: 0.9;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.nav-link.admin-stats {
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link.admin-stats:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Кнопки авторизации/профиля (только для десктопа) */
.header-actions.desktop-only {
    display: flex;
    gap: 12px;
    align-items: center;
}

.profile-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-link:hover {
    background: rgba(255, 255, 255, 0.25);
}

.auth-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.login-link, .register-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.login-link {
    background: rgba(255, 255, 255, 0.15);
}

.login-link:hover {
    background: rgba(255, 255, 255, 0.25);
}

.register-link {
    background: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

.register-link:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Кнопка мобильного меню */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Мобильное меню */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #FFF 0%, #FDF8F8 100%);
    z-index: 2000;
    padding: 30px 25px;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #F0D6E2;
}

.mobile-menu-logo {
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-dark);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-menu-close:hover {
    background: rgba(214, 51, 132, 0.1);
    color: var(--primary);
}

.mobile-menu-section {
    margin-bottom: 25px;
}

.mobile-menu-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-menu-link {
    padding: 14px 18px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.mobile-menu-link:hover {
    background: rgba(214, 51, 132, 0.1);
    color: var(--primary);
}

.mobile-menu-link.active {
    background: var(--primary-gradient);
    color: white;
}

.mobile-menu-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.mobile-premium-info {
    background: linear-gradient(135deg, #FFF, #FDF8F8);
    border-radius: 12px;
    padding: 20px;
    border: 2px dashed var(--primary-light);
    margin: 20px 0;
    text-align: center;
}

.mobile-premium-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mobile-premium-date {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.mobile-premium-upgrade {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

.mobile-premium-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(214, 51, 132, 0.3);
}

.mobile-logout-btn {
    background: none;
    border: none;
    padding: 14px 18px;
    border-radius: 12px;
    color: var(--text-dark);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.mobile-logout-btn:hover {
    background: #ffebee;
    color: #d32f2f;
}

/* Основной контент чата */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 60px;
    margin-bottom: 80px;
    overflow-y: auto;
    padding: 0 15px;
}

.chat-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: white;
    margin: 0 -15px;
    padding: 15px;
    border-bottom: 1px solid #F0D6E2;
    box-shadow: 0 2px 4px rgba(214, 51, 132, 0.05);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.chat-header-info .chat-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
    box-shadow: var(--shadow);
}

.user-info h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--text-dark);
}

.user-info p {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-dot {
    width: 8px;
    height: 8px;
    background-color: #4CD964;
    border-radius: 50%;
    display: inline-block;
}

.usage-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pro-badge, .usage-badge {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pro-badge {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
}

.usage-badge {
    background: rgba(214, 51, 132, 0.1);
    color: var(--primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    position: relative;
    line-height: 1.4;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-user {
    align-self: flex-end;
    background: var(--message-user);
    color: white;
    border-bottom-right-radius: 5px;
}

.message-partner {
    align-self: flex-start;
    background-color: var(--message-partner);
    color: #e2246d;
    border-bottom-left-radius: 5px;
    border: 1px solid #e2266f00;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 5px;
    text-align: right;
}

.typing-indicator {
    align-self: flex-start;
    background-color: var(--message-partner);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 5px;
    color: #e2246d;
    font-style: italic;
    margin-bottom: 10px;
    display: none;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* ФИКСИРОВАННОЕ ПОЛЕ ВВОДА */
.chat-input-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    padding: 12px 16px;
    border-top: 1px solid #F0D6E2;
    box-shadow: 0 -2px 12px rgba(214, 51, 132, 0.08);
    z-index: 1000;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 2px;
}

.btn {
    background-color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.btn:hover {
    background-color: var(--primary);
    color: white;
    transform: scale(1.05);
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.chat-input {
    width: 100%;
    background-color: #FDF8F8;
    border: 1px solid #F0D6E2;
    border-radius: 12px;
    padding: 12px 50px 12px 18px;
    color: var(--text-dark);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    min-height: 44px;
    max-height: 200px;
    resize: none;
    overflow-y: auto;
    line-height: 1.4;
}

.chat-input:focus {
    background-color: white;
    box-shadow: 0 0 0 2px var(--primary-light);
}

.send-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 2px;
}

.send-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.3);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Стили для кнопок действий с рассказом */
.story-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.story-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 0.8rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.message-partner .story-btn {
    background: rgba(214, 51, 132, 0.1);
    border: 1px solid rgba(214, 51, 132, 0.3);
    color: var(--primary);
}

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

.message-partner .story-btn:hover {
    background: rgba(214, 51, 132, 0.2);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .header {
        padding: 10px 12px;
        min-height: 56px;
    }

    .header-content {
        width: calc(100% - 20px);
    }

    .logo {
        font-size: 1.1rem;
    }

    .logo i {
        font-size: 1.3rem;
    }

    .desktop-nav {
        display: none;
    }

    .header-actions.desktop-only {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .chat-container {
        margin-top: 56px;
        margin-bottom: 72px;
        padding: 0 10px;
    }

    .chat-header {
        margin: 0 -10px;
        padding: 15px 10px;
    }

    .chat-header-info {
        width: calc(100% - 20px);
        gap: 10px;
    }

    .chat-header-info .chat-header-user {
        gap: 10px;
    }

    .message {
        max-width: 90%;
    }

    .avatar {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .user-info h3 {
        font-size: 1.1rem;
    }

    .btn, .send-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .chat-input-fixed {
        padding: 10px 12px;
    }

    .chat-input {
        padding: 10px 45px 10px 16px;
        min-height: 40px;
        font-size: 0.95rem;
        max-height: 160px;
    }

    .story-actions {
        gap: 8px;
    }

    .story-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        width: calc(100% - 16px);
    }

    .chat-header-info {
        width: calc(100% - 16px);
        gap: 8px;
    }

    .chat-header-info .chat-header-user {
        gap: 8px;
    }

    .message {
        max-width: 95%;
    }

    .input-actions {
        gap: 6px;
    }

    .send-actions {
        gap: 6px;
    }

    .logo span {
        display: inline;
    }

    .story-actions {
        flex-direction: column;
        gap: 6px;
    }

    .story-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 360px) {
    .header-content {
        width: calc(100% - 12px);
    }

    .chat-header-info {
        width: calc(100% - 12px);
    }

    .user-info h3 {
        font-size: 1rem;
    }

    .user-info p {
        font-size: 0.8rem;
    }
}
