/**
 * FinBizTools Phase 9 - AI Tools & Utilities Styling
 */

/* Directory & Hub */
.fbt-ai-directory {
    margin: 20px 0 60px;
}

.fbt-ai-banner {
    background: linear-gradient(135deg, #eef5ef 0%, #e0ece3 100%);
    border: 1px solid #c8dcd0;
    border-radius: var(--radius, 18px);
    padding: 32px 36px;
    margin-bottom: 40px;
}

.fbt-ai-banner h2 {
    margin-top: 12px;
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    color: var(--ink, #172e2a);
}

.fbt-ai-banner p {
    font-size: 15.5px;
    max-width: 780px;
    color: var(--muted, #536762);
    margin-bottom: 12px;
}

.fbt-ai-group {
    margin: 36px 0;
}

.fbt-ai-group h3 {
    font-size: 20px;
    color: var(--ink, #172e2a);
    margin-bottom: 4px;
}

.fbt-group-desc {
    font-size: 14px;
    color: var(--muted, #536762);
    margin-bottom: 20px;
}

.fbt-ai-card {
    position: relative;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease;
}

.fbt-ai-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(18, 101, 78, 0.12);
    border-color: var(--green, #12654e);
}

.fbt-ai-card-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.badge-free {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.badge-draft {
    background: #fff8e1;
    color: #b78103;
    border: 1px solid #ffe082;
    font-size: 10px;
    letter-spacing: 0.05em;
    font-weight: 700;
}

/* Individual Tool Form */
.fbt-ai-tool {
    max-width: 860px;
    margin: 20px 0 50px;
}

.fbt-ai-notice {
    background: #fdfbf7;
    border-left: 4px solid var(--green, #12654e);
    border-radius: 4px;
    padding: 12px 18px;
    margin-bottom: 28px;
}

.fbt-ai-notice p {
    margin: 0;
    font-size: 13.5px;
    color: var(--ink, #172e2a);
}

.fbt-ai-form .fbt-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 26px;
}

.fbt-label-text {
    display: block;
    font-weight: 600;
    font-size: 14.5px;
    margin-bottom: 6px;
    color: var(--ink, #172e2a);
}

.fbt-label-text abbr {
    color: #c62828;
    text-decoration: none;
}

.fbt-ai-form input,
.fbt-ai-form select,
.fbt-ai-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #849e91;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    color: var(--ink, #172e2a);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fbt-ai-form input:focus,
.fbt-ai-form select:focus,
.fbt-ai-form textarea:focus {
    outline: none;
    border-color: var(--green, #12654e);
    box-shadow: 0 0 0 3px rgba(18, 101, 78, 0.15);
}

.fbt-char-count {
    display: block;
    text-align: right;
    font-size: 12px;
    color: var(--muted, #536762);
    margin-top: 4px;
}

.fbt-ai-submit-btn {
    background: var(--green, #12654e);
    color: #fff;
    border: 1px solid var(--green, #12654e);
    padding: 12px 26px;
    font-size: 15.5px;
    font-weight: 650;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.1s ease;
}

.fbt-ai-submit-btn:hover:not(:disabled) {
    background: #0b4938;
}

.fbt-ai-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Loading State */
.fbt-ai-loading {
    padding: 30px;
    background: #f7fbf8;
    border: 1px dashed var(--green, #12654e);
    border-radius: 12px;
    text-align: center;
    margin: 28px 0;
}

.fbt-spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto 14px;
    border: 3px solid rgba(18, 101, 78, 0.2);
    border-top-color: var(--green, #12654e);
    border-radius: 50%;
    animation: fbtSpin 0.8s linear infinite;
}

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

.fbt-ai-loading p {
    font-size: 14.5px;
    color: var(--ink, #172e2a);
    margin: 0;
    font-weight: 550;
}

/* Output Container */
.fbt-ai-output {
    margin-top: 36px;
    padding: 28px;
    background: #fff;
    border: 1px solid var(--line, #dce6df);
    border-radius: var(--radius, 18px);
    box-shadow: 0 4px 20px rgba(23, 46, 42, 0.05);
}

.fbt-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line, #dce6df);
}

.fbt-output-header h3 {
    margin: 0;
    font-size: 19px;
    color: var(--ink, #172e2a);
}

.fbt-output-content {
    font-size: 15px;
    line-height: 1.68;
    color: var(--ink, #172e2a);
}

.fbt-result-card {
    background: #fcfdfc;
    border: 1px solid #e2ede5;
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 18px;
}

.fbt-result-card h4 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--green, #12654e);
}

.fbt-result-card p {
    margin: 0;
    color: var(--ink, #172e2a);
    white-space: pre-wrap;
}

.fbt-result-card ul {
    margin: 8px 0 0;
    padding-left: 22px;
}

.fbt-result-card li {
    margin-bottom: 6px;
}

.fbt-output-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line, #dce6df);
}

/* Toast Notifications */
.fbt-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #172e2a;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.fbt-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* "Explain this Result" for Calculators */
.fbt-ai-explain-wrap {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #dce6df;
}

.fbt-ai-explain-btn {
    background: #eef5ef;
    color: var(--green, #12654e);
    border: 1px solid #b7d6c2;
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 650;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fbt-ai-explain-btn:hover {
    background: #ddead2;
    border-color: var(--green, #12654e);
}

.fbt-ai-explain-panel {
    background: #fcfdfc;
    border: 1px solid #cfe2d5;
    border-radius: 10px;
    padding: 20px 24px;
    margin-top: 14px;
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--ink, #172e2a);
    box-shadow: 0 3px 12px rgba(23, 46, 42, 0.04);
}

.fbt-ai-explain-panel h4 {
    margin: 0 0 10px;
    font-size: 15px;
    color: var(--green, #12654e);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fbt-ai-explain-panel p {
    margin: 0 0 10px;
}

.fbt-ai-explain-panel p:last-child {
    margin-bottom: 0;
}

@media (max-width: 680px) {
    .fbt-output-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .fbt-output-actions {
        flex-direction: column;
    }
    .fbt-output-actions button {
        width: 100%;
    }
}

