/**
 * SoftMit — AI Chat styling
 * Self-contained — δεν επηρεάζει υπόλοιπο styling
 * Συμβατό με dark mode
 */

/* ────── FLOATING ACTION BUTTON ────── */
.softmit-ai-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    height: 52px;
    padding: 0 18px 0 14px;
    border-radius: 26px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border: none;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9990;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
}
.softmit-ai-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6);
}
.softmit-ai-fab:active {
    transform: translateY(0);
}
.softmit-ai-fab svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.softmit-ai-fab .ai-fab-label {
    letter-spacing: 0.5px;
}

/* Pulse animation για να τραβήξει την προσοχή */
.softmit-ai-fab::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 30px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    opacity: 0;
    z-index: -1;
    animation: ai-fab-pulse 2.5s infinite;
}
@keyframes ai-fab-pulse {
    0%   { opacity: 0.4; transform: scale(1); }
    50%  { opacity: 0;   transform: scale(1.2); }
    100% { opacity: 0;   transform: scale(1.2); }
}

/* Mobile: μόνο εικονίδιο, smaller */
@media (max-width: 768px) {
    .softmit-ai-fab {
        bottom: 20px;
        left: 20px;
        padding: 0;
        width: 52px;
    }
    .softmit-ai-fab .ai-fab-label {
        display: none;
    }
}

/* ────── FIRST-TIME TOOLTIP ────── */
.softmit-ai-tooltip {
    position: fixed;
    bottom: 88px;
    left: 24px;
    z-index: 9991;
    max-width: 320px;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
.softmit-ai-tooltip.ai-tt-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.softmit-ai-tooltip .ai-tt-arrow {
    position: absolute;
    bottom: -8px;
    left: 30px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}
.softmit-ai-tooltip .ai-tt-content {
    background: white;
    color: #1e293b;
    padding: 18px 20px;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    position: relative;
}
.softmit-ai-tooltip .ai-tt-title {
    font-size: 15px;
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 8px;
}
.softmit-ai-tooltip .ai-tt-text {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 12px;
}
.softmit-ai-tooltip .ai-tt-dismiss {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}
.softmit-ai-tooltip .ai-tt-dismiss:hover {
    opacity: 0.9;
}

/* ────── MODAL ────── */
#softmit-ai-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    display: none;
    font-family: 'Segoe UI', system-ui, sans-serif;
}
#softmit-ai-modal.ai-open {
    display: block;
    animation: ai-fade-in 0.2s ease;
}
@keyframes ai-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
body.ai-no-scroll {
    overflow: hidden;
}

#softmit-ai-modal .ai-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
}

#softmit-ai-modal .ai-panel {
    position: absolute;
    bottom: 0;
    left: 24px;
    width: 420px;
    max-width: calc(100% - 48px);
    height: 80vh;
    max-height: 720px;
    background: white;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ai-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes ai-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* Mobile: full screen */
@media (max-width: 768px) {
    #softmit-ai-modal .ai-panel {
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Header */
#softmit-ai-modal .ai-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    flex-shrink: 0;
}
#softmit-ai-modal .ai-header-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
#softmit-ai-modal .ai-header-text {
    flex: 1;
    min-width: 0;
}
#softmit-ai-modal .ai-header-title {
    font-size: 15px;
    font-weight: 700;
}
#softmit-ai-modal .ai-header-status {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 1px;
}
#softmit-ai-modal .ai-new-btn,
#softmit-ai-modal .ai-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#softmit-ai-modal .ai-new-btn:hover,
#softmit-ai-modal .ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
#softmit-ai-modal .ai-new-btn svg,
#softmit-ai-modal .ai-close-btn svg {
    width: 16px;
    height: 16px;
}

/* Body */
#softmit-ai-modal .ai-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Welcome */
#softmit-ai-modal .ai-welcome {
    text-align: center;
    padding: 30px 16px;
    color: #475569;
}
#softmit-ai-modal .ai-welcome-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: ai-bounce 2s ease-in-out infinite;
}
@keyframes ai-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
#softmit-ai-modal .ai-welcome h3 {
    font-size: 20px;
    color: #1e293b;
    margin-bottom: 6px;
    font-weight: 700;
}
#softmit-ai-modal .ai-welcome p {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 18px;
}
#softmit-ai-modal .ai-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
#softmit-ai-modal .ai-suggestion {
    background: white;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-family: inherit;
}
#softmit-ai-modal .ai-suggestion:hover {
    border-color: #6366f1;
    background: #eef2ff;
    color: #1e293b;
    transform: translateX(2px);
}

/* Messages */
#softmit-ai-modal .ai-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    animation: ai-msg-in 0.25s ease;
}
@keyframes ai-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
#softmit-ai-modal .ai-msg-user {
    justify-content: flex-end;
}
#softmit-ai-modal .ai-msg-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
#softmit-ai-modal .ai-msg-user .ai-msg-bubble {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border-bottom-right-radius: 4px;
}
#softmit-ai-modal .ai-msg-assistant .ai-msg-bubble {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
#softmit-ai-modal .ai-msg-error .ai-msg-bubble {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
#softmit-ai-modal .ai-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* Markdown content inside messages */
#softmit-ai-modal .ai-msg-content p {
    margin: 0 0 8px 0;
}
#softmit-ai-modal .ai-msg-content p:last-child {
    margin-bottom: 0;
}
#softmit-ai-modal .ai-msg-content strong {
    font-weight: 700;
}
#softmit-ai-modal .ai-msg-content em {
    font-style: italic;
}
#softmit-ai-modal .ai-msg-content .ai-h1,
#softmit-ai-modal .ai-msg-content .ai-h2,
#softmit-ai-modal .ai-msg-content .ai-h3 {
    margin: 8px 0 6px 0;
    font-weight: 700;
    color: #1e293b;
}
#softmit-ai-modal .ai-msg-content .ai-h1 { font-size: 18px; }
#softmit-ai-modal .ai-msg-content .ai-h2 { font-size: 16px; }
#softmit-ai-modal .ai-msg-content .ai-h3 { font-size: 15px; }
#softmit-ai-modal .ai-msg-content .ai-list {
    margin: 6px 0 6px 18px;
    padding: 0;
}
#softmit-ai-modal .ai-msg-content .ai-list li {
    margin-bottom: 3px;
}
#softmit-ai-modal .ai-msg-content .ai-icode {
    background: #f1f5f9;
    color: #1e293b;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    font-size: 12px;
}
#softmit-ai-modal .ai-msg-content .ai-code {
    background: #1e293b;
    color: #f1f5f9;
    padding: 10px 12px;
    border-radius: 8px;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    overflow-x: auto;
    margin: 8px 0;
    white-space: pre-wrap;
}

/* Typing indicator (3 dots animated) */
#softmit-ai-modal .ai-typing {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}
#softmit-ai-modal .ai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: ai-typing 1.2s infinite;
}
#softmit-ai-modal .ai-typing span:nth-child(2) { animation-delay: 0.2s; }
#softmit-ai-modal .ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Input row */
#softmit-ai-modal .ai-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
#softmit-ai-modal .ai-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    color: #0f172a;
    background: #f8fafc;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    min-height: 40px;
    max-height: 140px;
}
#softmit-ai-modal .ai-input:focus {
    border-color: #6366f1;
    background: white;
}
#softmit-ai-modal .ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
#softmit-ai-modal .ai-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}
#softmit-ai-modal .ai-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}
#softmit-ai-modal .ai-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
#softmit-ai-modal .ai-send-btn.ai-btn-loading {
    animation: ai-btn-spin 1s linear infinite;
}
@keyframes ai-btn-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
#softmit-ai-modal .ai-send-btn svg {
    width: 18px;
    height: 18px;
    transform: rotate(0deg);
}

/* Footer */
#softmit-ai-modal .ai-footer {
    padding: 6px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 10px;
    background: white;
    border-top: 1px solid #f1f5f9;
}

/* ────── DARK MODE COMPATIBILITY ────── */
html[data-theme="dark"] #softmit-ai-modal .ai-panel {
    background: #1e293b;
}
html[data-theme="dark"] #softmit-ai-modal .ai-body {
    background: #0f172a;
}
html[data-theme="dark"] #softmit-ai-modal .ai-welcome h3 {
    color: #f1f5f9;
}
html[data-theme="dark"] #softmit-ai-modal .ai-welcome p,
html[data-theme="dark"] #softmit-ai-modal .ai-welcome {
    color: #94a3b8;
}
html[data-theme="dark"] #softmit-ai-modal .ai-suggestion {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}
html[data-theme="dark"] #softmit-ai-modal .ai-suggestion:hover {
    background: #312e81;
    border-color: #6366f1;
    color: #f1f5f9;
}
html[data-theme="dark"] #softmit-ai-modal .ai-msg-assistant .ai-msg-bubble {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}
html[data-theme="dark"] #softmit-ai-modal .ai-input-row {
    background: #1e293b;
    border-color: #334155;
}
html[data-theme="dark"] #softmit-ai-modal .ai-input {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}
html[data-theme="dark"] #softmit-ai-modal .ai-input:focus {
    background: #0f172a;
    border-color: #6366f1;
}
html[data-theme="dark"] #softmit-ai-modal .ai-footer {
    background: #1e293b;
    border-color: #334155;
}
html[data-theme="dark"] #softmit-ai-modal .ai-msg-content .ai-icode {
    background: #334155;
    color: #f1f5f9;
}
