﻿/* platform.css â€” Minimal tokens for gaps MudBlazor doesn't cover
   MudThemeProvider handles colors, typography, spacing.
   This file covers: shadows, animations, RTL utils, state primitives. */

/* ========== Custom Tokens ========== */
:root {
    /* Shadows (MudBlazor elevation covers most, these are design-specific) */
    --ammn-shadow-card: 0px 12px 16px 0px color-mix(in srgb, var(--n900) 4%, transparent);
    --ammn-shadow-glass: 0 8px 32px color-mix(in srgb, var(--n900) 10%, transparent);
    --ammn-shadow-hover: 0px 16px 24px 0px color-mix(in srgb, var(--n900) 8%, transparent);
    /* Animations */
    --ammn-transition-fast: 0.2s ease;
    --ammn-transition-base: 0.3s ease;
    /* Radius overrides for non-MudBlazor elements */
    --ammn-radius-full: 999px;
}

/* ========== RTL Layout Helpers ========== */
[dir="rtl"] {
    --ammn-dir: rtl;
}

/* ========== State Primitives ========== */

/* Loader */
.ammn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Wizard resume gate (Phase 2 item 12 / R4): occupies the wizard content
   slot while the resume-confirm decision is pending so no saved step
   flashes underneath the dialog. */
.wizard-resume-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    width: 100%;
}

/* Wizard resume confirm dialog — self-contained CSS modal. Replaces the
   MudDialog usage that stopped rendering after the MudBlazor 9 upgrade
   (the inline `<MudDialog @bind-Visible>` pattern was deprecated). */
.wizard-resume-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1300;
}

.wizard-resume-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1301;
    padding: 1rem;
}

.wizard-resume-modal__card {
    background: var(--n0, #fff);
    color: var(--text, #111);
    border-radius: var(--radius-md, 12px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    max-width: 440px;
    width: 100%;
    padding: 24px;
    font-family: var(--font-body);
}

.wizard-resume-modal__title {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text, #111);
}

.wizard-resume-modal__body {
    margin: 0 0 24px 0;
    font-size: 0.95rem;
    color: var(--n600, #555);
    line-height: 1.5;
}

.wizard-resume-modal__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.wizard-resume-modal__btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm, 8px);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: var(--font-body);
    transition: filter 0.15s ease, transform 0.05s ease;
}

.wizard-resume-modal__btn:active {
    transform: translateY(1px);
}

.wizard-resume-modal__btn--primary {
    background: var(--brand-green, #00875A);
    color: var(--n0, #fff);
    border-color: var(--brand-green, #00875A);
}

.wizard-resume-modal__btn--primary:hover {
    filter: brightness(1.05);
}

.wizard-resume-modal__btn--secondary {
    background: transparent;
    color: var(--text, #111);
    border-color: var(--border, #ccc);
}

.wizard-resume-modal__btn--secondary:hover {
    background: var(--n50, #f5f5f5);
}

/* Skeleton */
.ammn-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Empty State */
.ammn-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    gap: 1rem;
}

.ammn-empty-state__icon {
    width: 64px;
    height: 64px;
    opacity: 0.5;
}

.ammn-empty-state__title {
    font-size: 1.25rem;
    font-weight: 600;
}

.ammn-empty-state__message {
    font-size: 0.875rem;
    opacity: 0.7;
    max-width: 400px;
}

/* Error State */
.ammn-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    gap: 1rem;
}

.ammn-error-state__icon {
    width: 64px;
    height: 64px;
    opacity: 0.6;
}

.ammn-error-state__title {
    font-size: 1.25rem;
    font-weight: 600;
}

.ammn-error-state__message {
    font-size: 0.875rem;
    opacity: 0.7;
    max-width: 400px;
}

/* ========== Platform Layout ========== */

/* Service (wizard) layout */
.ammn-service-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.ammn-service-layout__content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Platform nav bar */
.ammn-platform-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--mud-palette-surface);
    box-shadow: var(--ammn-shadow-card);
}

.ammn-platform-nav__logo {
    height: 32px;
}

.ammn-platform-nav__controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========== Animations ========== */
@keyframes ammn-shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.ammn-shake {
    animation: ammn-shake 0.3s ease;
}

@keyframes ammn-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ammn-fade-in {
    animation: ammn-fade-in var(--ammn-transition-base);
}

/* ========== Insurance FAB ========== */
.insurance-fab {
    position: fixed;
    bottom: 32px;
    inset-inline-end: 32px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.insurance-fab__backdrop {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, black 30%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1099;
    animation: ammn-fade-in 0.2s ease;
}

.insurance-fab__menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1101;
    animation: insurance-fab-slide-up 0.3s ease;
}

.insurance-fab__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    padding-inline-end: 20px;
    background: var(--bg);
    border: none;
    border-radius: 16px;
    box-shadow: var(--ammn-shadow-card);
    cursor: pointer;
    transition: transform var(--ammn-transition-fast), box-shadow var(--ammn-transition-fast);
    min-width: 180px;
}

[data-theme="dark"] .insurance-fab__item {
    background: var(--n800);
    color: var(--n70);
}

.insurance-fab__item:hover {
    transform: translateY(-2px);
    box-shadow: var(--ammn-shadow-hover);
}

.insurance-fab__item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

.insurance-fab__item-label {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.insurance-fab__trigger {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--mud-palette-primary, var(--surface));
    color: var(--n0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform var(--ammn-transition-fast), background var(--ammn-transition-fast);
    z-index: 1101;
}

    .insurance-fab__trigger:hover {
        transform: scale(1.08);
    }

.insurance-fab__trigger--open {
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.insurance-fab__trigger-icon {
    width: 24px;
    height: 24px;
    transition: transform var(--ammn-transition-fast);
}

.insurance-fab__trigger--open .insurance-fab__trigger-icon {
    transform: rotate(90deg);
}

@keyframes insurance-fab-slide-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .insurance-fab {
        bottom: 20px;
        inset-inline-end: 20px;
    }

    .insurance-fab__item {
        min-width: 160px;
        padding: 8px;
        padding-inline-end: 16px;
    }
}

/* ========== ChatBot Widget ========== */

/* Floating trigger */
.chatbot-fab {
    position: fixed;
    bottom: 32px;
    inset-inline-start: 32px;
    z-index: 1090;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--brand-primary);
    color: var(--n0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform var(--ammn-transition-fast), box-shadow var(--ammn-transition-fast);
}

    .chatbot-fab:hover {
        transform: scale(1.08);
        box-shadow: 0 10px 30px rgba(var(--brand-green-rgb), 0.35);
    }

/* Panel */
.chatbot-panel {
    position: fixed;
    bottom: 32px;
    inset-inline-start: 32px;
    z-index: 1091;
    width: 380px;
    max-height: calc(100vh - 80px);
    background: var(--bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatbot-slide-up 0.3s ease;
}

/* Header */
.chatbot-panel__header {
    background: var(--brand-primary);
    color: var(--n0);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-panel__header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-panel__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-panel__header-text {
    display: flex;
    flex-direction: column;
}

.chatbot-panel__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.chatbot-panel__subtitle {
    font-size: 12px;
    opacity: 0.85;
}

.chatbot-panel__close {
    background: none;
    border: none;
    color: var(--n0);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--ammn-transition-fast);
}

    .chatbot-panel__close:hover {
        background: rgba(255, 255, 255, 0.2);
    }

/* Body */
.chatbot-panel__body {
    flex: 1;
    overflow-y: auto;
    min-height: 280px;
    max-height: 420px;
}

/* Welcome view */
.chatbot-welcome {
    padding: 20px 16px;
}

.chatbot-welcome__greeting {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
}

.chatbot-welcome__text {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.6;
}

/* Action buttons */
.chatbot-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--ammn-transition-fast), transform var(--ammn-transition-fast);
}

.chatbot-action-btn--primary {
    background: var(--brand-primary);
    color: var(--n0);
}

    .chatbot-action-btn--primary:hover {
        background: var(--brand-primary-hover);
        transform: translateY(-1px);
    }

.chatbot-action-btn--secondary {
    background: var(--surface);
    color: var(--text);
    margin-top: 8px;
}

    .chatbot-action-btn--secondary:hover {
        background: var(--n30);
    }

/* FAQ section */
.chatbot-faq {
    margin-top: 20px;
}

.chatbot-faq__title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px;
}

.chatbot-faq__loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.chatbot-faq__item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    overflow: hidden;
}

    .chatbot-faq__item[open] {
        background: var(--surface);
    }

.chatbot-faq__question {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .chatbot-faq__question::-webkit-details-marker {
        display: none;
    }

    .chatbot-faq__question::after {
        content: '+';
        font-size: 16px;
        font-weight: 400;
        color: var(--text-muted);
        transition: transform var(--ammn-transition-fast);
        flex-shrink: 0;
        margin-inline-start: 8px;
    }

.chatbot-faq__item[open] .chatbot-faq__question::after {
    content: '−';
}

.chatbot-faq__answer {
    padding: 0 14px 12px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Chat view */
.chatbot-chat__loading,
.chatbot-chat__error,
.chatbot-chat__ended {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.chatbot-chat__messages {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
}

.chatbot-chat__bubble {
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 85%;
    word-wrap: break-word;
}

    .chatbot-chat__bubble p {
        margin: 0;
        font-size: 14px;
        line-height: 1.5;
    }

.chatbot-chat__bubble--user {
    background: var(--brand-primary);
    color: var(--n0);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

[dir="rtl"] .chatbot-chat__bubble--user {
    border-bottom-right-radius: 16px;
    border-bottom-left-radius: 4px;
}

.chatbot-chat__bubble--bot {
    background: var(--surface);
    color: var(--text);
    align-self: flex-start;
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .chatbot-chat__bubble--bot {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
}

.chatbot-chat__time {
    font-size: 11px;
    opacity: 0.6;
    display: block;
    margin-top: 4px;
}

.chatbot-chat__bubble--user .chatbot-chat__time {
    text-align: end;
}

/* Typing indicator */
.chatbot-chat__typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

    .chatbot-chat__typing span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--text-muted);
        animation: chatbot-typing 1.2s infinite ease-in-out;
    }

        .chatbot-chat__typing span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .chatbot-chat__typing span:nth-child(3) {
            animation-delay: 0.4s;
        }

/* Input bar */
.chatbot-panel__input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

    .chatbot-panel__input input {
        flex: 1;
        border: 1px solid var(--border);
        border-radius: var(--radius-full);
        padding: 10px 16px;
        font-size: 14px;
        background: var(--surface);
        color: var(--text);
        outline: none;
        transition: border-color var(--ammn-transition-fast);
    }

.chatbot-panel__input input:focus {
    border-color: var(--brand-primary);
}

.chatbot-panel__input input::placeholder {
    color: var(--text-muted);
}

.chatbot-panel__send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--brand-primary);
    color: var(--n0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--ammn-transition-fast);
    flex-shrink: 0;
}

    .chatbot-panel__send:hover:not(:disabled) {
        background: var(--brand-primary-hover);
    }

    .chatbot-panel__send:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* RTL: flip send icon */
[dir="rtl"] .chatbot-panel__send svg {
    transform: scaleX(-1);
}

/* Animations */
@keyframes chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes chatbot-typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Quick links */
.chatbot-quick-links {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Chat actions bar */
.chatbot-chat__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-top: 1px solid var(--border);
}

/* Inline link button */
.chatbot-link-btn {
    background: none;
    border: none;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--ammn-transition-fast);
}

    .chatbot-link-btn:hover {
        background: rgba(var(--brand-green-rgb), 0.08);
    }

    .chatbot-link-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* Escalation success banner */
.chatbot-chat__escalated {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(var(--brand-green-rgb), 0.08);
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
}

/* Mobile */
@media (max-width: 480px) {
    .chatbot-fab {
        bottom: 20px;
        inset-inline-start: 20px;
    }

    .chatbot-panel {
        bottom: 0;
        inset-inline-start: 0;
        width: 100%;
        max-height: 100vh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
}
