/* Bootlegger AI Chat — Dark Speakeasy Theme */

:root {
    --bg-primary: #1e1f26;
    --bg-secondary: #252630;
    --bg-tertiary: #2f3040;
    --text-primary: #ffffff;
    --text-secondary: #b0b2c0;
    --accent: #e21b24;
    --accent-hover: #c41820;
    --accent-light: rgba(226, 27, 36, 0.12);
    --gold: #eed036;
    --gold-light: rgba(238, 208, 54, 0.12);
    --border-color: #3a3b4a;
    --user-bg: #2f3040;
    --assistant-bg: #1e1f26;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.chat-header {
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--accent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-logo span {
    color: var(--text-primary);
    font-weight: 700;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 10px;
    padding: 6px;
    color: white;
    box-shadow: 0 2px 8px rgba(226, 27, 36, 0.4);
}

.header-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: var(--gold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sound-toggle {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.sound-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sound-toggle svg {
    width: 20px;
    height: 20px;
}

.sound-toggle.muted .sound-on {
    display: none;
}

.sound-toggle.muted .sound-off {
    display: block !important;
}

.sound-toggle.muted {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: var(--bg-primary);
}

.message {
    display: flex;
    gap: 16px;
    max-width: 100%;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background: var(--accent);
    color: white;
}

.message.assistant .message-avatar svg {
    width: 20px;
    height: 20px;
}

.message.user .message-avatar {
    background: var(--bg-tertiary);
    color: var(--gold);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

.message-content {
    flex: 1;
    line-height: 1.6;
    font-size: 15px;
    color: var(--text-primary);
}

.message.user .message-content {
    background: var(--user-bg);
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Markdown styles */
.message-content .text-accent {
    color: var(--gold);
    font-size: 15px;
    display: block;
    margin-top: 8px;
}

.message-content .text-lg {
    font-size: 16px;
    display: block;
    margin-top: 8px;
}

.message-content .list-item {
    display: block;
    padding-left: 8px;
}

/* Product cards */
.product-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.product-card {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.product-card:hover {
    border-color: var(--gold);
    background: var(--gold-light);
}

.product-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-card-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.3;
}

.product-card-price {
    font-size: 13px;
    color: var(--gold);
    font-weight: 500;
}

.product-card-arrow {
    color: var(--text-secondary);
    transition: transform 0.2s, color 0.2s;
    flex-shrink: 0;
}

.product-card:hover .product-card-arrow {
    color: var(--gold);
    transform: translateX(2px);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.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); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Streaming cursor */
.streaming-cursor {
    color: var(--gold);
    animation: blink 0.8s infinite;
    font-weight: 300;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.message.streaming .message-content {
    min-height: 24px;
}

/* Rating Buttons */
.rating-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.rating-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rating-btn svg {
    width: 16px;
    height: 16px;
}

.rating-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--text-primary);
}

.rating-btn.like:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
    color: #22c55e;
}

.rating-btn.dislike:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.rating-btn.selected.like {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}

.rating-btn.selected.dislike {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.rating-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.rating-buttons.rated .rating-btn:not(.selected) {
    opacity: 0.3;
}

/* Quick Action Buttons */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.quick-action-btn:hover {
    border-color: var(--gold);
    background: var(--gold-light);
}

.quick-action-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.quick-action-btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.quick-action-icon {
    font-size: 16px;
    line-height: 1;
}

.quick-action-label {
    font-weight: 500;
}

/* Suggestions */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.suggestion-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-btn:hover {
    border-color: var(--gold);
    background: var(--gold-light);
    color: var(--gold);
}

/* Input */
.chat-input-container {
    padding: 16px 24px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.chat-form {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.chat-form:focus-within {
    border-color: var(--accent);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    padding: 8px 8px 8px 16px;
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    padding: 8px 0;
    line-height: 1.5;
}

.input-wrapper textarea::placeholder {
    color: var(--text-secondary);
}

.input-wrapper button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.input-wrapper button:not(:disabled) {
    background: var(--accent);
    color: white;
}

.input-wrapper button:not(:disabled):hover {
    background: var(--accent-hover);
}

.input-wrapper button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.input-wrapper button svg {
    width: 18px;
    height: 18px;
}

.input-footer {
    text-align: center;
    padding-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Lead form */
.lead-form {
    background: linear-gradient(135deg, #1e1f26 0%, #2f3040 100%);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    animation: fadeIn 0.3s ease;
}

.lead-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    color: var(--gold);
    font-weight: 600;
}

.lead-form-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}

.lead-form-close:hover {
    color: #ffffff;
}

.lead-form-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.lead-input {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.lead-input:focus {
    outline: none;
    border-color: var(--gold);
}

.lead-or {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

.lead-submit {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.lead-submit:hover {
    background: var(--accent-hover);
}

.lead-success {
    text-align: center;
    color: var(--gold);
    font-weight: 600;
    padding: 8px;
}

.lead-telegram-divider {
    display: flex;
    align-items: center;
    margin: 16px 0 12px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

.lead-telegram-divider::before,
.lead-telegram-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.lead-telegram-divider span {
    padding: 0 12px;
}

.lead-telegram-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: #0088cc;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.lead-telegram-btn:hover {
    background: #006699;
}

.lead-telegram-hint {
    text-align: center;
    margin-top: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

/* Mobile */
@media (max-width: 640px) {
    .chat-messages {
        padding: 16px;
    }

    .chat-input-container {
        padding: 12px 16px 16px;
    }

    .message {
        gap: 12px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .message.user .message-content {
        max-width: 90%;
    }

    .product-card {
        min-width: 100%;
    }
}
