/**
 * Bento AI Modal Styles
 * Interactive Q&A modal for Bento cards
 */

/* Modal Container - Hidden by default */
.bento-ai-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bento-ai-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* Glassmorphic Backdrop */
.bento-ai-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}

/* Modal Content Container */
.bento-ai-content {
    position: relative;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 10000;
}

.bento-ai-modal.active .bento-ai-content {
    transform: translateY(0);
}

/* Close Button */
.bento-ai-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.bento-ai-close:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    transform: rotate(90deg);
}

/* Modal Title */
.bento-ai-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-main);
    margin: 0 0 1.5rem 0;
    padding-right: 2rem;
}

/* Questions Grid */
.bento-ai-questions {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.bento-ai-question-btn {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.9375rem;
    color: var(--color-text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.bento-ai-question-btn::before {
    content: "💬";
    font-size: 1.25rem;
    flex-shrink: 0;
}

.bento-ai-question-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    transform: translateX(4px);
}

.bento-ai-question-btn:active {
    transform: translateX(4px) scale(0.98);
}

.bento-ai-question-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Custom Input Area */
.bento-ai-input-area {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.bento-ai-input {
    flex: 1;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    color: var(--color-text-main);
    transition: all 0.2s ease;
}

.bento-ai-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.1);
}

.bento-ai-send-btn {
    background: var(--color-accent);
    border: none;
    border-radius: 12px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bento-ai-send-btn:hover {
    transform: scale(1.05);
    background: #d63025;
    /* Darker shade of accent */
}

.bento-ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Header Row */
.bento-ai-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
    /* Space for close button */
}

.bento-ai-title {
    margin: 0;
    padding: 0;
}

/* Markdown Content Styling */
.bento-ai-answer h1,
.bento-ai-answer h2,
.bento-ai-answer h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1.1em;
}

.bento-ai-answer ul,
.bento-ai-answer ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.bento-ai-answer li {
    margin-bottom: 0.25rem;
}

.bento-ai-answer strong {
    font-weight: 600;
    color: var(--color-accent);
}

.bento-ai-answer code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.bento-ai-answer pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

/* Response Container */
.bento-ai-response {
    display: none;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    animation: slideUp 0.3s ease;
}

.bento-ai-response.active {
    display: block;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.bento-ai-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
}

.bento-ai-loading::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Response Content */
.bento-ai-answer {
    color: var(--color-text-main);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.bento-ai-answer p {
    margin: 0 0 1rem 0;
}

.bento-ai-answer p:last-child {
    margin-bottom: 0;
}

/* Error State */
.bento-ai-error {
    color: #e74c3c;
    font-size: 0.9375rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.bento-ai-error::before {
    content: "⚠️";
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Back to Questions Button */
.bento-ai-back-btn {
    margin-top: 1rem;
    padding: 0.75rem 1.25rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.bento-ai-back-btn::before {
    content: "←";
}

.bento-ai-back-btn:hover {
    background: var(--color-bg-alt);
    color: var(--color-text-main);
    border-color: var(--color-accent);
}

/* Make Bento Cards Clickable */
.bento-card {
    cursor: pointer;
    position: relative;
}

.bento-card::after {
    content: "💬";
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bento-card:hover::after {
    opacity: 0.3;
}

.bento-card:active {
    transform: scale(0.98);
}

/* Responsive - Mobile */
@media (max-width: 576px) {
    .bento-ai-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
        border-radius: 16px;
    }

    .bento-ai-close {
        top: 1rem;
        right: 1rem;
        width: 32px;
        height: 32px;
        font-size: 1.25rem;
    }

    .bento-ai-title {
        font-size: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .bento-ai-question-btn {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    .bento-ai-question-btn::before {
        font-size: 1rem;
    }

    .bento-ai-response {
        padding: 1.25rem;
    }

    .bento-ai-answer {
        font-size: 0.875rem;
    }

    /* Hide chat emoji on mobile cards */
    .bento-card::after {
        display: none;
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .bento-ai-backdrop {
        background: rgba(0, 0, 0, 0.8);
    }

    .bento-ai-content {
        background: rgba(20, 20, 20, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .bento-ai-question-btn {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .bento-ai-response {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }
}