﻿/* web_chat/static/css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body {
    background: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 16px 12px;
}
.chat-container {
    max-width: 800px;
    width: 100%;
    background: white;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 95vh;
    max-height: 900px;
}
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.chat-header h1 {
    font-size: 20px;
    font-weight: 600;
}
.chat-header .actions {
    display: flex;
    gap: 10px;
}
.chat-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}
.chat-header button:hover {
    background: rgba(255,255,255,0.35);
}
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 15px;
    animation: fadeIn 0.3s ease;
}
.message.user {
    align-self: flex-end;
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}
.message.bot {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.message.system {
    align-self: center;
    background: #e8e8e8;
    color: #555;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 30px;
    max-width: 90%;
    text-align: center;
}
.message .timestamp {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}
.message.user .timestamp { color: rgba(255,255,255,0.7); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ===== КАРТИНКИ ===== */
.image-block {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
    justify-content: center;
    width: 100%;
}
.image-card {
    flex: 1 1 calc(50% - 16px);
    min-width: 200px;
    max-width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s;
    border: 1px solid #eee;
}
.image-card.single {
    flex: 0 1 100%;
    max-width: 500px;
    margin: 0 auto;
}
.image-card .img-wrapper {
    position: relative;
    cursor: pointer;
    background: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.image-card .img-wrapper img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
    transition: opacity 0.2s;
}
.image-card .img-wrapper .zoom-hint {
    position: absolute;
    bottom: 8px;
    right: 12px;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 30px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.image-card .img-wrapper:hover .zoom-hint {
    opacity: 1;
}
.image-card .image-label {
    padding: 10px 14px 6px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.image-card .image-label .badge {
    background: #667eea;
    color: white;
    font-size: 11px;
    padding: 2px 12px;
    border-radius: 30px;
    font-weight: 400;
}
.image-card .image-actions {
    padding: 8px 14px 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.image-card .image-actions button {
    flex: 1;
    min-width: 60px;
    padding: 6px 0;
    border: none;
    border-radius: 30px;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
    background: #f0f2f5;
    color: #333;
}
.image-card .image-actions button.download {
    background: #48bb78;
    color: white;
}
.image-card .image-actions button.download:hover {
    background: #38a169;
}
.image-card .image-actions button.delete {
    background: #fc8181;
    color: white;
}
.image-card .image-actions button.delete:hover {
    background: #e53e3e;
}
.image-card .image-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== МОДАЛКА ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-overlay.active {
    display: flex;
}
.modal-overlay .modal-content {
    max-width: 95%;
    max-height: 95%;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-overlay .modal-content img {
    width: 100%;
    height: auto;
    max-height: 90vh;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}
.modal-overlay .modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.modal-overlay .modal-close:hover {
    background: rgba(255,255,255,0.2);
}

/* ===== ОСТАЛЬНОЕ ===== */
.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: #888;
    font-size: 15px;
    background: #f9f9f9;
    border-radius: 16px;
    border: 2px dashed #ddd;
    margin: 10px 0;
}
.empty-state .icon {
    font-size: 48px;
    margin-bottom: 10px;
}
.final-state {
    text-align: center;
    padding: 30px 20px;
    background: #f0f7ff;
    border-radius: 16px;
    border: 2px solid #667eea;
    margin: 16px 0;
}
.final-state .thanks {
    font-size: 22px;
    font-weight: 600;
    color: #333;
}
.final-state .sub {
    color: #666;
    margin: 8px 0 16px;
}
.final-state .actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.final-state .actions button {
    padding: 10px 24px;
    border: none;
    border-radius: 40px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s;
}
.final-state .actions .new-session {
    background: #667eea;
    color: white;
}
.final-state .actions .new-session:hover {
    background: #5a67d8;
}
.final-state .actions .donate {
    background: #f6ad55;
    color: white;
}
.final-state .actions .donate:hover {
    background: #ed8936;
}
.input-area {
    padding: 12px 16px 16px;
    background: white;
    border-top: 1px solid #e8e8e8;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.input-area textarea {
    flex: 1;
    min-width: 150px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 30px;
    resize: none;
    font-size: 15px;
    outline: none;
    transition: 0.2s;
    min-height: 48px;
    max-height: 120px;
    font-family: inherit;
}
.input-area textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.input-area .btn-group {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.input-area button {
    padding: 10px 20px;
    border: none;
    border-radius: 30px;
    background: #667eea;
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
    height: 48px;
}
.input-area button:hover {
    background: #5a67d8;
}
.input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.input-area button.venting-btn {
    background: #9f7aea;
}
.input-area button.venting-btn:hover {
    background: #805ad5;
}
.input-area button.finish-writing-btn {
    background: #f6ad55;
}
.input-area button.finish-writing-btn:hover {
    background: #ed8936;
}
@media (max-width: 600px) {
    body { padding: 8px 6px; }
    .chat-container { height: 100vh; max-height: none; border-radius: 16px; }
    .chat-header h1 { font-size: 16px; }
    .chat-header button { font-size: 12px; padding: 4px 12px; }
    .messages { padding: 12px 10px; }
    .message { max-width: 92%; font-size: 14px; padding: 10px 14px; }
    .image-card { flex: 1 1 100%; min-width: 0; }
    .image-card .img-wrapper img { max-height: 300px; }
    .input-area { padding: 8px 10px 12px; flex-direction: column; }
    .input-area textarea { min-height: 44px; font-size: 14px; border-radius: 20px; }
    .input-area .btn-group { justify-content: stretch; }
    .input-area button { flex: 1; height: 44px; font-size: 14px; }
    .modal-overlay .modal-content { max-width: 98%; }
    .modal-overlay .modal-close { top: 8px; right: 10px; width: 36px; height: 36px; font-size: 22px; }
}
@media (max-width: 400px) {
    .image-card .image-actions button { font-size: 12px; padding: 4px 0; }
    .image-card .image-label { font-size: 13px; }
}
#sendBtn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    position: relative;
}
#sendBtn:disabled::after {
    content: '🚫';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    opacity: 0.8;
}
/* ===== ЯЗЫКОВОЕ ОКНО ===== */
.lang-option {
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.lang-option:hover {
    border-color: #667eea;
    background: #f0f0ff;
}
.lang-option.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}
.modal-box {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}
.modal-box h3 {
    margin-bottom: 12px;
    font-size: 18px;
    color: #333;
}
.modal-box p {
    margin-bottom: 16px;
    font-size: 14px;
    color: #666;
}
.action-btn.primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 15px;
    cursor: pointer;
    transition: 0.2s;
}
.action-btn.primary:hover {
    background: #5a67d8;
}