/**
 * ═══════════════════════════════════════════════════════════════════════════
 * RADIM SIMPLE CHAT - WhatsApp-style UI
 * Radim Teal theme — Light Theme
 * ═══════════════════════════════════════════════════════════════════════════
 */

.radim-simple-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);  /* Fill available space (minus topbar+bottomnav) */
    min-height: 400px;
    max-height: 800px;
    max-width: 800px;
    margin: 0 auto;
    background: linear-gradient(135deg, #f0f5f5 0%, #fff 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(91, 168, 160, 0.12);
    overflow: hidden;
}

@media (max-width: 1024px) {
    .radim-simple-chat-container {
        height: calc(100vh - 250px);  /* Mobile: topbar(90) + info(40) + bottomnav(70) + margin(50) */
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Ensure input never gets cut off */
.radim-chat-input-container {
    flex-shrink: 0;
}

.radim-chat-header {
    flex-shrink: 0;
}

/* Header */
.radim-chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--radim-teal), var(--radim-teal-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(91, 168, 160, 0.2);
}

.radim-chat-avatar {
    position: relative;
}

.radim-avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--radim-teal-light), var(--radim-teal));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 2px 8px rgba(91, 168, 160, 0.3);
}

.radim-chat-title {
    flex: 1;
}

.radim-chat-title h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.radim-chat-status {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 400;
}

.radim-chat-status.connected {
    color: #a5d6a7;
}

.radim-chat-status.disconnected {
    color: #ffccbc;
}

.radim-chat-actions {
    display: flex;
    gap: 0.5rem;
}

.radim-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.25rem;
    transition: background 0.2s;
}

.radim-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
.radim-chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--bg-tertiary, #f0f5f5);
    background-image:
        radial-gradient(circle at 20% 80%, rgba(91, 168, 160, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(113, 182, 184, 0.03) 0%, transparent 50%);
}

/* Welcome Message */
.radim-chat-welcome {
    text-align: center;
    padding: 1.5rem;
    margin: 1rem auto;
    max-width: 400px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(91, 168, 160, 0.08);
}

.radim-welcome-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.radim-chat-welcome h3 {
    margin: 0 0 0.25rem 0;
    color: var(--accent-primary, #5BA8A0);
    font-size: 1.3rem;
}

.radim-chat-welcome p {
    margin: 0.5rem 0;
    color: var(--text-muted, #718096);
}

/* Message Bubbles */
.radim-message {
    display: flex;
    margin-bottom: 1rem;
    animation: messageSlideIn 0.3s ease-out;
}

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

.radim-message-user {
    justify-content: flex-end;
}

.radim-message-assistant {
    justify-content: flex-start;
}

.radim-message-error {
    justify-content: center;
}

.radim-message-bubble {
    max-width: 70%;
    padding: 0.875rem 1.125rem;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(91, 168, 160, 0.1);
    position: relative;
}

.radim-message-user .radim-message-bubble {
    background: linear-gradient(135deg, var(--radim-teal), var(--radim-teal-dark));
    color: white;
    border-bottom-right-radius: 4px;
}

.radim-message-assistant .radim-message-bubble {
    background: white;
    color: var(--text-primary, #2d3748);
    border-bottom-left-radius: 4px;
}

.radim-message-error .radim-message-bubble {
    background: #fff5f5;
    color: #c53030;
    border-radius: 12px;
    text-align: center;
}

.radim-message-text {
    font-size: 1rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.radim-message-time {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.7;
    text-align: right;
}

.radim-message-user .radim-message-time {
    color: rgba(255, 255, 255, 0.9);
}

.radim-message-assistant .radim-message-time {
    color: var(--text-disabled, #a0aec0);
}

/* Typing Indicator */
.radim-typing {
    margin-bottom: 1rem;
}

.radim-typing-dots {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.radim-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-disabled, #a0aec0);
    animation: typingBounce 1.4s infinite;
}

.radim-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.radim-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Input Container */
.radim-chat-input-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(91, 168, 160, 0.06);
    border-top: 1px solid rgba(91, 168, 160, 0.1);
}

.radim-chat-input {
    flex: 1;
    padding: 0.875rem 1.125rem;
    border: 2px solid rgba(91, 168, 160, 0.2);
    border-radius: 24px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text-primary, #2d3748);
    background: #fff;
}

.radim-chat-input::placeholder {
    color: var(--text-disabled, #a0aec0);
}

.radim-chat-input:focus {
    border-color: var(--accent-primary, #5BA8A0);
    box-shadow: 0 0 0 3px rgba(91, 168, 160, 0.12);
}

.radim-send-button,
.radim-voice-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1.25rem;
}

.radim-send-button {
    background: linear-gradient(135deg, var(--radim-teal), var(--radim-teal-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(91, 168, 160, 0.3);
}

.radim-send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(91, 168, 160, 0.4);
}

.radim-voice-button {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.radim-voice-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

/* Voice Recording State */
.radim-voice-button.recording {
    background: linear-gradient(135deg, #fc8181, #f56565) !important;
    box-shadow: 0 2px 12px rgba(245, 101, 101, 0.4) !important;
    animation: voicePulse 1.2s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 4px 20px rgba(245, 101, 101, 0.5); }
}

/* Suggested Buttons */
.radim-suggested-buttons {
    display: none;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(91, 168, 160, 0.05);
}

.radim-suggestion-btn {
    padding: 0.5rem 1rem;
    border: 1.5px solid rgba(91, 168, 160, 0.3);
    border-radius: 20px;
    background: white;
    color: var(--accent-primary, #5BA8A0);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.radim-suggestion-btn:hover {
    background: var(--accent-primary, #5BA8A0);
    color: white;
}

/* ─── Education Tip (Neuron → Vzdělávání) ─── */
.radim-edu-tip {
    margin: 0.5rem 1rem;
    animation: eduTipIn 0.4s ease-out;
}

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

.radim-edu-tip-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f0 100%);
    border: 1.5px solid rgba(91, 168, 160, 0.3);
    border-radius: 12px;
    font-size: 0.85rem;
    color: #334155;
    position: relative;
}

.radim-edu-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.radim-edu-tip-text {
    flex: 1;
    line-height: 1.4;
}

.radim-edu-tip-text em {
    display: block;
    color: var(--accent-primary, #5BA8A0);
    font-weight: 600;
    font-style: normal;
    margin-top: 2px;
}

.radim-edu-tip-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 8px;
    background: var(--accent-primary, #5BA8A0);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    font-family: inherit;
}

.radim-edu-tip-btn:hover {
    background: #4a9890;
}

.radim-edu-tip-close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
}

.radim-edu-tip-close:hover {
    color: #64748b;
}

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

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

.radim-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(91, 168, 160, 0.15);
    border-radius: 3px;
}

.radim-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(91, 168, 160, 0.25);
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .radim-simple-chat-container {
        height: 100%;
        border-radius: 0;
        margin: 0;
        box-shadow: none;
    }

    .radim-chat-header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .radim-chat-header .radim-chat-avatar {
        width: 36px;
        height: 36px;
    }

    .radim-avatar-circle {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .radim-chat-title h3 {
        font-size: 1rem;
    }

    .radim-chat-status {
        font-size: 0.75rem;
    }

    .radim-chat-messages {
        min-height: 0;
        flex: 1 1 0%;
        overflow-y: auto;
        padding: 0.75rem;
    }

    .radim-chat-welcome {
        margin: 0.25rem auto;
        padding: 0.75rem 1rem;
        max-width: 280px;
    }

    .radim-welcome-icon {
        font-size: 1.75rem;
        margin-bottom: 0.25rem;
    }

    .radim-chat-welcome h3 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }

    .radim-chat-welcome p {
        margin: 0.2rem 0;
        font-size: 0.85rem;
    }

    .radim-chat-input-container {
        padding: 0.5rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
        gap: 0.4rem;
        flex-shrink: 0;
        background: rgba(91, 168, 160, 0.06);
        border-top: 1px solid rgba(91, 168, 160, 0.1);
    }

    .radim-chat-input {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        color: var(--text-primary, #2d3748);
        background: #fff;
        border: 2px solid rgba(91, 168, 160, 0.2);
    }

    .radim-chat-input::placeholder {
        color: var(--text-disabled, #a0aec0);
    }

    .radim-send-button,
    .radim-voice-button {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .radim-message-bubble {
        max-width: 92%;
    }

    .radim-suggested-buttons {
        background: rgba(91, 168, 160, 0.05);
        padding: 0.4rem 0.5rem;
        gap: 0.4rem;
    }

    .radim-suggestion-btn {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        background: white;
        color: var(--accent-primary, #5BA8A0);
        border-color: rgba(91, 168, 160, 0.25);
    }

    .radim-suggestion-btn:hover {
        background: var(--accent-primary, #5BA8A0);
        color: white;
    }

    /* Education tip — mobile layout */
    .radim-edu-tip {
        margin: 0.4rem 0.5rem;
    }

    .radim-edu-tip-inner {
        flex-wrap: wrap;
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        gap: 0.4rem;
    }

    .radim-edu-icon {
        font-size: 1.2rem;
    }

    .radim-edu-tip-text {
        flex: 1 1 60%;
        min-width: 0;
    }

    .radim-edu-tip-btn {
        width: 100%;
        text-align: center;
        padding: 0.5rem;
        min-height: 44px;
        font-size: 0.85rem;
    }
}
