/**
 * NowBizAI Assistant Styles - Enhanced Interactive Version
 *
 * @package NowBizAI
 * @copyright 2025 NowDigi LLC
 */

/* Field-level AI Button */
.nowbizai-field-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-left: 8px;
    background: linear-gradient(135deg, var(--nowbiz-primary, #377BA6) 0%, var(--nowbiz-primary-dark, #2a5f80) 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.nowbizai-field-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: white;
}

.nowbizai-field-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(55, 123, 166, 0.4);
}

.nowbizai-field-btn:active {
    transform: scale(1.05);
}

/* AI Indicator Button (Header) */
.nowbizai-indicator {
    display: inline-block;
    margin-left: 1rem;
}

.nowbizai-assist-btn,
.nowbizai-goal-suggest-btn,
.nowbizai-sprint-suggest-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.nowbizai-assist-btn .dashicons,
.nowbizai-goal-suggest-btn .dashicons,
.nowbizai-sprint-suggest-btn .dashicons {
    font-size: 18px;
}

.nowbizai-assist-btn:hover {
    transform: translateY(-1px);
}

/* AI Offline State */
.nowbizai-indicator--offline {
    opacity: 0.85;
}

.nowbizai-assist-btn--offline,
.nowbizai-assist-btn--offline:hover {
    background: var(--nowbiz-bg-muted, #e0e0e0) !important;
    color: var(--nowbiz-text-muted, #888) !important;
    cursor: not-allowed !important;
    transform: none !important;
    border-color: var(--nowbiz-border-color, #ccc) !important;
}

.nowbizai-icon--offline {
    position: relative;
    color: var(--nowbiz-text-muted, #888) !important;
}

/* Crossed-out icon effect */
.nowbizai-icon--offline::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: var(--nowbiz-danger, #c0392b);
    transform: rotate(-45deg);
    border-radius: 1px;
}

/* Web Research Button (Step 2) - matches AI Assistant button style */
.nowbizai-web-research .nowbizai-web-research-btn {
    background: linear-gradient(135deg, var(--nowbiz-primary, #0073aa), var(--nowbiz-primary-dark, #005177));
    border: 1px solid var(--nowbiz-primary-dark, #005177);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

.nowbizai-web-research .nowbizai-web-research-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
    background: linear-gradient(135deg, var(--nowbiz-primary-dark, #005177), var(--nowbiz-primary, #0073aa));
}

.nowbizai-web-research .nowbizai-web-research-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Web Research Form */
.nowbizai-web-research-form .nowbizai-field-info {
    margin-bottom: 0.5rem;
    color: #333;
    font-size: 1.1em;
}

.nowbizai-web-research-form .nowbizai-field-info .dashicons {
    color: #0073aa;
    vertical-align: middle;
    margin-right: 0.25rem;
}

/* Web Research Results */
.nowbizai-web-research-results {
    max-height: 60vh;
    overflow-y: auto;
}

.nowbizai-field-item:hover {
    background: #f8f9fa;
}

/* Toast notification animation */
.nowbizai-toast {
    animation: nowbizai-toast-in 0.3s ease;
}

@keyframes nowbizai-toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* AI Modal */
.nowbizai-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(46, 37, 28, 0.75);
    backdrop-filter: blur(4px);
}

.nowbizai-modal.is-active {
    display: flex;
}

.nowbizai-modal__content {
    background: var(--nowbiz-bg-elevated, #fff);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
    max-width: 640px;
    width: 95%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.nowbizai-modal__header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--nowbiz-border-color, #ddd);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--nowbiz-bg-subtle, #f9f9f9);
}

.nowbizai-modal__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--nowbiz-text-heading, #40301F);
}

.nowbizai-modal__title .dashicons {
    color: var(--nowbiz-primary, #377BA6);
}

.nowbizai-modal__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--nowbiz-text-muted, #666);
    transition: color 0.2s;
}

.nowbizai-modal__close:hover {
    color: var(--nowbiz-text-primary, #000);
}

.nowbizai-modal__body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.nowbizai-modal__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--nowbiz-border-color, #ddd);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    background: var(--nowbiz-bg-subtle, #f9f9f9);
}

/* Interactive Form Styles */
.nowbizai-interactive {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.nowbizai-field-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--nowbiz-bg-info, #e6f5fb);
    border-radius: 8px;
    color: var(--nowbiz-primary-dark, #2a5f80);
}

.nowbizai-field-info .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.nowbizai-context-info {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--nowbiz-bg-subtle, #f9f9f9);
    border-radius: 6px;
    font-size: 0.875rem;
}

.nowbizai-context-item {
    color: var(--nowbiz-text-secondary, #555);
}

.nowbizai-context-item strong {
    color: var(--nowbiz-text-primary, #333);
}

.nowbizai-hint-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nowbizai-hint-section label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.9375rem;
}

.nowbizai-hint-section label .dashicons {
    color: var(--nowbiz-accent, #DAA520);
}

.nowbizai-hint-section label small {
    color: var(--nowbiz-text-muted, #666);
    font-weight: normal;
    flex-basis: 100%;
    margin-left: 1.5rem;
}

.nowbizai-hint-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--nowbiz-border-color, #ddd);
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.nowbizai-hint-input:focus {
    outline: none;
    border-color: var(--nowbiz-primary, #377BA6);
    box-shadow: 0 0 0 3px rgba(55, 123, 166, 0.15);
}

.nowbizai-hint-input::placeholder {
    color: var(--nowbiz-text-muted, #999);
    font-style: italic;
}

/* Style Options */
.nowbizai-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nowbizai-option {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--nowbiz-bg-subtle, #f5f5f5);
    border: 2px solid var(--nowbiz-border-color, #ddd);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.nowbizai-option:hover {
    background: var(--nowbiz-bg-hover, #eee);
}

.nowbizai-option input {
    margin: 0;
}

.nowbizai-option input:checked + span {
    color: var(--nowbiz-primary, #377BA6);
    font-weight: 600;
}

.nowbizai-option:has(input:checked) {
    border-color: var(--nowbiz-primary, #377BA6);
    background: var(--nowbiz-bg-info, #e6f5fb);
}

/* AI Suggestions List */
.nowbizai-suggestions-header {
    margin-bottom: 1rem;
    color: var(--nowbiz-text-secondary, #555);
    font-size: 0.9375rem;
}

.nowbizai-suggestions {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nowbizai-suggestion {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--nowbiz-bg-subtle, #f9f9f9);
    border: 2px solid var(--nowbiz-border-light, #eee);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.nowbizai-suggestion:hover {
    background: var(--nowbiz-bg-hover, #f0f0f0);
    border-color: var(--nowbiz-primary, #377BA6);
    box-shadow: 0 2px 8px rgba(55, 123, 166, 0.1);
}

.nowbizai-suggestion.is-selected {
    background: var(--nowbiz-bg-info, #e6f5fb);
    border-color: var(--nowbiz-primary, #377BA6);
    box-shadow: 0 0 0 3px rgba(55, 123, 166, 0.15);
}

.nowbizai-suggestion__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--nowbiz-primary, #377BA6);
    color: white;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.nowbizai-suggestion.is-selected .nowbizai-suggestion__number {
    background: var(--nowbiz-success, #4caf50);
}

.nowbizai-suggestion__text {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--nowbiz-text-primary, #000);
}

/* Loading State */
.nowbizai-loading {
    text-align: center;
    padding: 3rem 2rem;
}

.nowbizai-loading__spinner {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid var(--nowbiz-border-light, #eee);
    border-top-color: var(--nowbiz-primary, #377BA6);
    border-radius: 50%;
    animation: nowbizai-spin 0.8s linear infinite;
}

@keyframes nowbizai-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.nowbizai-loading__text {
    margin-top: 1rem;
    color: var(--nowbiz-text-muted, #666);
    font-size: 0.9375rem;
}

/* Error State */
.nowbizai-error {
    padding: 1.5rem;
    background: var(--nowbiz-bg-danger, #f4e5e1);
    border: 1px solid var(--nowbiz-bg-danger-border, #e0b8ac);
    border-radius: 8px;
    text-align: center;
}

.nowbizai-error__icon {
    font-size: 32px;
    color: var(--nowbiz-bg-danger-text, #6b2e1f);
    margin-bottom: 0.5rem;
}

.nowbizai-error p {
    margin: 0.5rem 0 0;
    color: var(--nowbiz-bg-danger-text, #6b2e1f);
}

/* Field Update Animation */
.nowbizai-updated {
    animation: nowbizai-flash 1s ease;
}

@keyframes nowbizai-flash {
    0% { background-color: inherit; }
    25% { background-color: rgba(76, 175, 80, 0.3); }
    75% { background-color: rgba(76, 175, 80, 0.3); }
    100% { background-color: inherit; }
}

/* Market Report Styles */
.nowbizai-report {
    max-width: 900px;
    margin: 0 auto;
}

.nowbizai-report__title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--nowbiz-text-heading, #40301F);
}

.nowbizai-report__meta {
    font-size: 0.875rem;
    color: var(--nowbiz-text-muted, #666);
    margin-bottom: 2rem;
}

.nowbizai-report__section {
    margin-bottom: 2.5rem;
}

.nowbizai-report__section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--nowbiz-text-heading, #40301F);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--nowbiz-primary, #377BA6);
}

.nowbizai-report__section-content {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--nowbiz-text-primary, #2E251C);
}

.nowbizai-report__section-content p {
    margin-bottom: 1rem;
}

/* Button Styles in Modal */
.nowbizai-modal__footer .nowbiz-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .nowbizai-modal__content {
        width: 98%;
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
        margin-top: auto;
    }

    .nowbizai-modal__header,
    .nowbizai-modal__body,
    .nowbizai-modal__footer {
        padding: 1rem;
    }

    .nowbizai-indicator {
        display: block;
        margin: 0.5rem 0;
    }

    .nowbizai-options {
        flex-direction: column;
    }

    .nowbizai-context-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nowbizai-modal__footer {
        flex-direction: column;
    }

    .nowbizai-modal__footer .nowbiz-btn {
        width: 100%;
        justify-content: center;
    }
}
