/* public/assets/css/chat.css */

/* ===== ОБЩИЕ СТИЛИ ЧАТА ===== */
html, body {
    height: 100%;
    width: 100%;
    background: #17212b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    background: #17212b;
}

/* ===== ЧАТ ===== */
.chat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background: #17212b;
}

.chat-header {
    background: #17212b;
    padding: 12px 16px 12px 70px;
    border-bottom: 1px solid #2b3743;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    flex-shrink: 0;
}

.chat-header-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

.chat-header-info {
    flex: 1;
}

.chat-header-info h1 {
    font-size: 18px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.chat-header-info p {
    font-size: 13px;
    color: #8e9eae;
    margin: 4px 0 0;
}

.chat-messages-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.chat-messages {
    padding: 16px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-chat {
    text-align: center;
    color: #8e9eae;
    padding: 40px;
}

.chat-input-wrapper {
    background: #17212b;
    padding: 10px 12px 12px;
    border-top: 1px solid #2b3743;
    flex-shrink: 0;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #2b3743;
    border-radius: 24px;
    padding: 6px 6px 6px 16px;
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 0;
    color: white;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    height: 40px;
}

.chat-input::placeholder {
    color: #8e9eae;
}

.send-btn {
    background: #5288c1;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== СООБЩЕНИЯ ===== */
.message {
    display: flex;
    width: 100%;
    animation: fadeIn 0.2s ease;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.assistant .message-bubble {
    background: #2b3743;
    color: white;
    border-radius: 18px 18px 18px 4px;
}

.message.user .message-bubble {
    background: #5288c1;
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.message-time {
    font-size: 10px;
    color: #8e9eae;
    margin-top: 4px;
    display: block;
}

.message.user .message-time {
    text-align: right;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.voice-play-btn {
    background: none;
    border: none;
    color: #8e9eae;
    font-size: 14px;
    cursor: pointer;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 20px;
    transition: all 0.2s;
}

.voice-play-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.voice-play-btn.playing {
    animation: pulse 1s infinite;
    color: #5288c1;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ===== ИЗОБРАЖЕНИЯ ===== */
.message-image {
    margin-top: 12px;
    position: relative;
    display: inline-block;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
}

.generated-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.generated-image:hover {
    transform: scale(1.02);
}

.image-view-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.message-image:hover .image-view-btn {
    opacity: 1;
}

/* ===== ВИДЕО ===== */
.message-video {
    margin-top: 12px;
    position: relative;
    display: inline-block;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    max-width: 300px;
}

.generated-video {
    max-width: 300px;
    max-height: 300px;
    border-radius: 16px;
    display: block;
}

.video-view-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.message-video:hover .video-view-btn {
    opacity: 1;
}

/* ===== ИНДИКАТОР ПЕЧАТАНИЯ ===== */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #2b3743;
    border-radius: 18px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #8e9eae;
    border-radius: 50%;
    animation: typingPulse 1.2s infinite;
}

@keyframes typingPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ===== ЛИМИТ ===== */
.chat-header-limit {
    margin-left: auto;
}

.limit-badge {
    background: #2b3743;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: #8e9eae;
}

.limit-badge.low {
    background: #f59e0b;
    color: white;
}

.limit-badge.zero {
    background: #ef4444;
    color: white;
}

/* ===== ХЕДЕР-ДЕЙСТВИЯ ===== */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hire-btn-small {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.hire-btn-small:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.hire-btn-small:active {
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .hire-btn-small .hire-text {
        display: none;
    }
    .hire-btn-small {
        width: 32px;
        height: 32px;
        padding: 0;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
}

/* ===== АДАПТИВ ===== */
@supports (padding: max(0px)) {
    .chat-header {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(70px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    .burger {
        top: max(12px, env(safe-area-inset-top));
        left: max(12px, env(safe-area-inset-left));
    }
    .chat-input-wrapper {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px;
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 32px;
    cursor: pointer;
}

/* ===== ПРЕДЛОЖЕНИЕ ПРЕМИУМА ===== */
.premium-offer {
    display: flex;
    justify-content: center;
    padding: 20px;
    animation: fadeInUp 0.4s ease;
}

.premium-offer-card {
    background: linear-gradient(135deg, #1a1a3a 0%, #0a0a2a 100%);
    border-radius: 20px;
    padding: 16px 20px;
    color: white;
    border: 1px solid rgba(102, 126, 234, 0.3);
    max-width: 380px;
    width: 100%;
}

.premium-offer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.premium-offer-text h3 {
    font-size: 16px;
    margin-bottom: 4px;
    color: #ffd700;
}

.premium-offer-reset {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.premium-offer-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.premium-offer-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ===== ВСТРОЕННАЯ АВТОРИЗАЦИЯ ===== */
.inline-auth-form {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
    background: #1e2a36;
    padding: 8px 12px;
    border-radius: 20px;
    max-width: 530px;
}

.inline-auth-form input {
    padding: 6px 12px;
    border: 1px solid #3a4a5a;
    border-radius: 20px;
    background: #17212b;
    color: white;
    font-size: 13px;
}

.inline-auth-form input::placeholder {
    color: #8e9eae;
}

.inline-auth-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.inline-auth-error {
    color: #ef4444;
    font-size: 12px;
    width: 100%;
    display: none;
}

.inline-auth-success-user {
    display: inline-block;
    background: #22c55e20;
    color: #22c55e;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    margin: 8px 0;
}

/* ===== PWA ===== */
.pwa-install-btn {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s;
    margin: 4px 0;
}

.pwa-install-btn:hover {
    transform: scale(1.02);
}

.toast-notification {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #2b3743;
    color: white;
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 14px;
    z-index: 10001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}