/* DoIt GPT Chat - Dark Theme Integration */

/* ========================================
   CHAT BUBBLE STYLES
   ======================================== */

#doitChatBubble {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--gradient-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: var(--doit-dark);
    box-shadow: 0 4px 16px rgba(0, 215, 117, 0.3);
    z-index: 9998;
    transition: all 0.3s ease;
    border: 2px solid var(--doit-green);
}

#doitChatBubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 215, 117, 0.4);
}

#doitChatBubble.open {
    display: none;
}

/* ========================================
   CHAT BOX STYLES
   ======================================== */

#doitChatBox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 500px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--doit-dark-secondary);
    border: 1px solid var(--doit-border);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#doitChatBox.open {
    display: flex;
}

#doitChatHeader {
    background: linear-gradient(135deg, var(--doit-green) 0%, var(--doit-green-light) 100%);
    color: var(--doit-dark);
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--doit-border);
}

#doitChatClose {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: var(--doit-dark);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

#doitChatClose:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: rotate(90deg);
}

#doitChatBody {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--doit-dark);
}

#doitChatBody::-webkit-scrollbar {
    width: 6px;
}

#doitChatBody::-webkit-scrollbar-track {
    background: var(--doit-dark-secondary);
}

#doitChatBody::-webkit-scrollbar-thumb {
    background: var(--doit-border);
    border-radius: 3px;
}

#doitChatBody::-webkit-scrollbar-thumb:hover {
    background: var(--doit-green);
}

#doitChatBody .message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}

#doitChatBody .user {
    background: linear-gradient(135deg, var(--doit-green) 0%, var(--doit-green-light) 100%);
    color: var(--doit-dark);
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 80%;
    margin-left: auto;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 215, 117, 0.2);
}

#doitChatBody .bot {
    background: var(--doit-dark-tertiary);
    color: var(--doit-text);
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 80%;
    margin-right: auto;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid var(--doit-border-light);
}

#doitChatBody .bot.typing {
    background: var(--doit-dark-tertiary);
    color: var(--doit-text-muted);
    padding: 12px 16px;
}

#doitChatFooter {
    border-top: 1px solid var(--doit-border);
    padding: 10px;
    background: var(--doit-dark-secondary);
}

#doitChatFooter .remaining {
    text-align: center;
    color: var(--doit-text-muted);
    font-size: 11px;
    margin-bottom: 8px;
}

#doitChatFooter .remaining span {
    color: var(--doit-green);
    font-weight: 600;
}

#doitChatForm {
    display: flex;
    gap: 8px;
    padding: 0;
}

#doitChatInput {
    flex: 1;
    padding: 12px;
    background: var(--doit-dark);
    color: var(--doit-text);
    border: 1px solid var(--doit-border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

#doitChatInput::placeholder {
    color: var(--doit-text-muted);
}

#doitChatInput:focus {
    border-color: var(--doit-green);
    box-shadow: 0 0 0 3px rgba(0, 215, 117, 0.1);
}

#doitChatInput:disabled {
    background: var(--doit-dark-tertiary);
    opacity: 0.6;
    cursor: not-allowed;
}

#doitChatSend {
    background: var(--doit-green);
    color: var(--doit-dark);
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#doitChatSend:hover:not(:disabled) {
    background: var(--doit-green-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 215, 117, 0.3);
}

#doitChatSend:disabled {
    background: var(--doit-text-dark);
    cursor: not-allowed;
    opacity: 0.5;
}

/* ========================================
   INLINE CHAT STYLES
   ======================================== */

#doitChatInline {
    max-width: 900px;
    margin: 40px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--doit-dark-secondary);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border: 1px solid var(--doit-border);
}

#doitChatInlineHeader {
    background: linear-gradient(135deg, var(--doit-green) 0%, var(--doit-green-light) 100%);
    color: var(--doit-dark);
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid var(--doit-border);
}

#doitChatInlineHeader h1 {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#doitChatInlineHeader p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
    font-weight: 500;
}

#doitChatInlineBody {
    height: 500px;
    overflow-y: auto;
    padding: 25px;
    background: var(--doit-dark);
}

#doitChatInlineBody::-webkit-scrollbar {
    width: 8px;
}

#doitChatInlineBody::-webkit-scrollbar-track {
    background: var(--doit-dark-secondary);
}

#doitChatInlineBody::-webkit-scrollbar-thumb {
    background: var(--doit-border);
    border-radius: 4px;
}

#doitChatInlineBody::-webkit-scrollbar-thumb:hover {
    background: var(--doit-green);
}

#doitChatInlineBody:empty::before {
    content: "🤖 Hi! I'm your AI trading assistant. Ask me anything about trading, indicators, or Expert Advisors!";
    display: block;
    text-align: center;
    color: var(--doit-text-muted);
    font-style: italic;
    margin-top: 180px;
    font-size: 18px;
    padding: 0 20px;
    line-height: 1.6;
}

#doitChatInline .message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}

#doitChatInline .message.user {
    justify-content: flex-end;
}

#doitChatInline .message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

#doitChatInline .message.user .message-content {
    background: linear-gradient(135deg, var(--doit-green) 0%, var(--doit-green-light) 100%);
    color: var(--doit-dark);
    border-bottom-right-radius: 6px;
    box-shadow: 0 3px 12px rgba(0, 215, 117, 0.2);
    font-weight: 500;
}

#doitChatInline .message.bot .message-content {
    background: var(--doit-dark-tertiary);
    color: var(--doit-text);
    border: 1px solid var(--doit-border-light);
    border-bottom-left-radius: 6px;
}

#doitChatInline .typing {
    background: var(--doit-dark-tertiary);
    color: var(--doit-text-muted);
    padding: 16px 20px;
    border-radius: 20px 20px 20px 6px;
    border: 1px solid var(--doit-border-light);
    max-width: 70%;
}

#doitChatInlineFooter {
    background: var(--doit-dark-secondary);
    padding: 20px;
    border-top: 1px solid var(--doit-border);
}

#doitChatInlineStatus {
    text-align: center;
    padding: 8px;
    color: var(--doit-text-muted);
    font-size: 13px;
    margin-bottom: 15px;
}

#doitChatInlineStatus span {
    color: var(--doit-green);
    font-weight: 600;
}

#doitChatInlineForm {
    display: flex;
    gap: 10px;
}

#doitChatInlineInput {
    flex: 1;
    padding: 14px 18px;
    background: var(--doit-dark);
    color: var(--doit-text);
    border: 1px solid var(--doit-border);
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
}

#doitChatInlineInput::placeholder {
    color: var(--doit-text-muted);
}

#doitChatInlineInput:focus {
    border-color: var(--doit-green);
    box-shadow: 0 0 0 3px rgba(0, 215, 117, 0.1);
}

#doitChatInlineInput:disabled {
    background: var(--doit-dark-tertiary);
    opacity: 0.6;
    cursor: not-allowed;
}

#doitChatInlineSend {
    background: var(--doit-green);
    color: var(--doit-dark);
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#doitChatInlineSend:hover:not(:disabled) {
    background: var(--doit-green-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 215, 117, 0.3);
}

#doitChatInlineSend:disabled {
    background: var(--doit-text-dark);
    cursor: not-allowed;
    opacity: 0.5;
}

/* ========================================
   MODAL STYLES (DARK THEME)
   ======================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--doit-dark-secondary);
    padding: 35px;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--doit-border);
}

.modal h3 {
    margin: 0 0 20px 0;
    color: var(--doit-green);
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal p {
    margin: 0 0 25px 0;
    color: var(--doit-text);
    line-height: 1.6;
    font-size: 15px;
}

.modal p b {
    color: var(--doit-green);
}

.modal input {
    width: 100%;
    padding: 14px;
    margin: 10px 0 20px;
    background: var(--doit-dark);
    color: var(--doit-text);
    border: 1px solid var(--doit-border);
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s;
}

.modal input::placeholder {
    color: var(--doit-text-muted);
}

.modal input:focus {
    border-color: var(--doit-green);
    box-shadow: 0 0 0 3px rgba(0, 215, 117, 0.1);
}

.modal button {
    padding: 14px 28px;
    background: var(--doit-green);
    color: var(--doit-dark);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin: 5px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal button:hover {
    background: var(--doit-green-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 215, 117, 0.3);
}

.modal button:disabled {
    background: var(--doit-text-dark);
    cursor: not-allowed;
    opacity: 0.5;
}

.modal button.secondary {
    background: var(--doit-dark-tertiary);
    color: var(--doit-text);
    border: 1px solid var(--doit-border);
}

.modal button.secondary:hover {
    background: var(--doit-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.status-message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
}

.status-success {
    background: rgba(0, 215, 117, 0.1);
    color: var(--doit-green);
    border: 1px solid var(--doit-border);
}

.status-error {
    background: rgba(255, 71, 87, 0.1);
    color: var(--doit-red);
    border: 1px solid var(--doit-border-red);
}

/* ========================================
   TYPING INDICATOR
   ======================================== */

.typing-indicator {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--doit-green);
    border-radius: 50%;
    margin: 0 2px;
    opacity: 0.3;
    animation: blink 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 80%, 100% {
        opacity: 0.3;
    }
    40% {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    #doitChatBox {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        right: 10px;
        bottom: 10px;
        border-radius: 12px;
    }
    
    #doitChatInline {
        margin: 20px 10px;
        border-radius: 12px;
    }
    
    #doitChatInlineHeader h1 {
        font-size: 24px;
    }
    
    #doitChatInlineBody {
        height: 400px;
    }
    
    #doitChatInline .message-content,
    #doitChatInline .typing {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    #doitChatBubble {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    #doitChatBox {
        width: 100vw;
        height: 100vh;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
    
    .modal-content {
        width: 95%;
        padding: 25px;
    }
}