/* AI Button & Modal Styles */

/* --- AI Trigger Button --- */
.ai-trigger-wrapper {
    margin-bottom: 2rem;
    display: flex;
    justify-content: flex-start;
    /* Align to start as per "first visible element" usually implies reading flow */
}

/* RTL Adjustment if needed, dashboard is dir="rtl" */
[dir="rtl"] .ai-trigger-wrapper {
    justify-content: flex-start;
}

/* Animated Border Flow */
@keyframes border-flow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.ai-live-border {
    background: linear-gradient(90deg, #5aa9ff, #8dbfff, #3a86ff, #5aa9ff);
    background-size: 300% 100%;
    animation: border-flow 3s linear infinite;
    opacity: 1 !important;
}

/* Button Glow Pulse */
.ai-btn-glow {
    box-shadow: 0 0 15px rgba(90, 169, 255, 0.4);
    animation: glow-pulse 3s infinite ease-in-out;
}

@keyframes glow-pulse {
    0% {
        box-shadow: 0 0 10px rgba(90, 169, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 25px rgba(90, 169, 255, 0.5);
    }

    100% {
        box-shadow: 0 0 10px rgba(90, 169, 255, 0.3);
    }
}

/* --- AI Modal --- */
.ai-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.ai-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ai-modal-content {
    background: #0d1626;
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    padding: 2.5rem;
    position: relative;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(90, 169, 255, 0.1);
    background: linear-gradient(to bottom right, #0d1626, #050a14);
}

.ai-modal-overlay.active .ai-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.ai-modal-icon {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, #1a2a4a, #0d1626);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #d4af37;
    font-size: 2rem;
    box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.1), 0 10px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.ai-modal-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #d4af37 0%, #f3cf55 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-modal-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.ai-modal-action-btn {
    background: linear-gradient(135deg, #d4af37 0%, #aa8c2c 100%);
    color: #000;
    font-weight: 800;
    padding: 1rem 2.5rem;
    border-radius: 16px;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(212, 175, 55, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.ai-modal-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(79, 70, 229, 0.4);
}

.ai-modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    /* Checked RTL, might need left if padding isn't enough, but usually X is top-corner */
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

[dir="rtl"] .ai-modal-close-btn {
    right: auto;
    left: 1.25rem;
}

.ai-modal-close-btn:hover {
    background-color: #f1f5f9;
    color: #ef4444;
}