/* =============================
   MANAGER AI ASSISTANT — WINTER GLASS
   File: resources/css/manager/ai-assistant.css
   Full file replacement (clean + unified tone styles)
================================ */

:root{
    /* берём дух админ-лейаута */
    --ai-page-bg: #f3f6ff;

    --ai-blue:   #7bbcff;
    --ai-cyan:   #67e8f9;
    --ai-violet: #c4b5fd;
    --ai-pink:   #fda4af;
    --ai-gold:   #ffd59a;
    --ai-green:  #86efac;

    --ai-text: #0f172a;
    --ai-muted: rgba(15,23,42,.62);

    --ai-glass: rgba(255,255,255,0.78);
    --ai-glass-2: rgba(255,255,255,0.62);

    --ai-border: rgba(210, 230, 255, 0.62);
    --ai-border-2: rgba(15,23,42,0.08);

    --ai-shadow-strong: 0 18px 45px rgba(0,0,0,0.25);
    --ai-shadow-soft: 0 10px 30px rgba(15,23,42,0.12);

    --ai-radius: 18px;
}

/* =============================
   FAB BUTTON
================================ */

.mw-ai-fab{
    position: fixed;
    right: 24px;
    bottom: 70px; /* чуть выше, чтобы не падало на нижние элементы */
    width: 56px;
    height: 56px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.22);
    color: rgba(6,10,24,0.92);
    cursor: pointer;
    z-index: 9999;

    background:
        radial-gradient(circle at 30% 20%, rgba(255,255,255,0.72), transparent 46%),
        radial-gradient(circle at 75% 75%, rgba(123,188,255,0.30), transparent 55%),
        linear-gradient(135deg, rgba(123,188,255,0.95), rgba(103,232,249,0.72));

    box-shadow:
        0 18px 45px rgba(0,0,0,0.22),
        inset 0 1px 0 rgba(255,255,255,0.28);
    transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}

.mw-ai-fab:hover{
    transform: translateY(-2px);
    box-shadow:
        0 22px 60px rgba(0,0,0,0.26),
        inset 0 1px 0 rgba(255,255,255,0.30);
    filter: brightness(1.02);
}

.mw-ai-fab:active{
    transform: translateY(0);
}

.mw-ai-fab i{
    font-size: 19px;
    display: inline-block;
    animation: mwWandFloat 2.2s ease-in-out infinite, mwWandShine 2.2s ease-in-out infinite;
    transform-origin: 50% 60%;
    will-change: transform, filter;
}

.mw-ai-fab:hover i{
    animation-duration: 1.3s;
}
/* маленькая “живая” точка уведомления (если нужно) */
.mw-ai-fab .mw-ai-dot{
    position:absolute;
    right: 6px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #8b5cf6;
    box-shadow: 0 0 0 0 rgba(139,92,246,.55);
    animation: mwAiPulseDot 1.35s ease-out infinite;
}
@keyframes mwAiPulseDot {
    0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(139,92,246,.55); }
    70%  { transform: scale(1.18); box-shadow: 0 0 0 10px rgba(139,92,246,0); }
    100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(139,92,246,0); }
}

/* =============================
   PANEL (GLASS + WINTER)
================================ */

.mw-ai-panel{
    position: fixed;
    right: 18px;
    bottom: 160px;
    width: 440px;
    max-width: calc(100vw - 36px);
    max-height: min(72vh, 720px);

    border-radius: var(--ai-radius);
    border: 1px solid var(--ai-border);
    overflow: hidden;
    z-index: 9999;

    background:
        radial-gradient(1200px 700px at 18% -10%, rgba(123,188,255,.16), transparent 60%),
        radial-gradient(900px 600px at 85% 10%, rgba(196,181,253,.12), transparent 58%),
        radial-gradient(800px 500px at 40% 120%, rgba(103,232,249,.10), transparent 55%),
        linear-gradient(180deg, rgba(255,255,255,0.90) 0%, rgba(255,255,255,0.76) 100%);

    box-shadow: var(--ai-shadow-strong);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    display: none;
}

.mw-ai-panel.is-open{
    display: block;
    animation: mwAiPop .16s ease-out;
}

@keyframes mwAiPop{
    from { transform: translateY(6px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

/* =============================
   HEADER
================================ */

.mw-ai-head{
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    padding: 11px 12px;
    border-bottom: 1px solid rgba(15,23,42,0.06);

    background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.76));
}

.mw-ai-head::after{
    content:"";
    position:absolute;
    left:-14px;
    right:-14px;
    bottom:-1px;
    height: 1px;
    background: linear-gradient(90deg,
    transparent,
    rgba(123,188,255,0.28),
    rgba(103,232,249,0.22),
    rgba(255,213,154,0.18),
    transparent
    );
    opacity: 0.9;
    pointer-events: none;
}

.mw-ai-title{
    display:flex;
    align-items:center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: .2px;
    color: var(--ai-text);
    font-size: 14px;
}

.mw-ai-title .dot{
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(123,188,255,0.70));
    box-shadow: 0 0 0 6px rgba(123,188,255,0.14);
}

.mw-ai-close{
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,0.10);
    background: rgba(249,250,251,0.86);
    cursor: pointer;

    display:inline-flex;
    align-items:center;
    justify-content:center;

    box-shadow: 0 10px 18px rgba(15,23,42,0.08);
    transition: transform .14s ease, box-shadow .14s ease;
}

.mw-ai-close:hover{
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(15,23,42,0.12);
}

.mw-ai-close i{
    color: rgba(15,23,42,0.75);
    font-size: 16px;
}

/* =============================
   BODY
================================ */

.mw-ai-body{
    padding: 12px 12px 14px;
    overflow: auto;
    max-height: calc(min(72vh, 720px) - 60px);
}

/* textarea */
.mw-ai-textarea{
    width: 100%;
    min-height: 118px;
    resize: vertical;

    border-radius: 14px;
    border: 1px solid rgba(148,163,184,.55);
    padding: 10px 12px;

    outline: none;
    font-size: 13px;
    color: var(--ai-text);
    background: rgba(255,255,255,0.78);

    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}

.mw-ai-textarea:focus{
    border-color: rgba(123,188,255,0.55);
    box-shadow: 0 0 0 4px rgba(123,188,255,0.14);
}

/* buttons row */
.mw-ai-row{
    display:flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.mw-ai-btn{
    border: 1px solid rgba(15,23,42,0.10);
    border-radius: 12px;
    padding: 9px 12px;
    font-weight: 650;
    font-size: 13px;
    cursor: pointer;

    display:inline-flex;
    align-items:center;
    gap: 8px;

    transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.mw-ai-btn i{
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.12));
}

.mw-ai-btn--primary{
    color: rgba(6,10,24,0.92);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.05)),
        linear-gradient(135deg, rgba(123,188,255,0.14), rgba(103,232,249,0.10));
}

.mw-ai-btn--primary:hover{
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(15,23,42,0.12);
    background:
        linear-gradient(135deg, rgba(123,188,255,0.16), rgba(103,232,249,0.12));
}

.mw-ai-btn--ghost{
    color: rgba(15,23,42,0.88);
    background: rgba(255,255,255,0.62);
}

.mw-ai-btn--ghost:hover{
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(15,23,42,0.12);
    background: rgba(255,255,255,0.74);
}

.mw-ai-btn:disabled{
    opacity: .68;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* meta / status line */
.mw-ai-meta{
    margin-top: 10px;
    font-size: 12px;
    color: var(--ai-muted);
}

/* result card */
.mw-ai-card{
    margin-top: 12px;
    border-radius: 16px;
    border: 1px solid rgba(210,230,255,0.60);

    background:
        radial-gradient(560px 220px at 15% 0%, rgba(123,188,255,0.10), transparent 60%),
        radial-gradient(420px 220px at 85% 10%, rgba(196,181,253,0.08), transparent 58%),
        linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.66));

    box-shadow: var(--ai-shadow-soft);
    padding: 10px 12px;
}

.mw-ai-kv{
    display:flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: rgba(15,23,42,0.74);
}
.mw-ai-kv b{
    color: rgba(6,10,24,0.92);
}

.mw-ai-list{
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 12px;
    color: rgba(15,23,42,0.78);
}

/* rewrite box */
.mw-ai-rewrite{
    margin-top: 10px;
    padding: 10px 10px;
    border-radius: 14px;
    border: 1px solid rgba(123,188,255,0.20);

    background:
        linear-gradient(135deg, rgba(123,188,255,0.10), rgba(103,232,249,0.06));
}

.mw-ai-rewrite .label{
    font-size: 12px;
    font-weight: 800;
    color: rgba(6,10,24,0.92);
    margin-bottom: 6px;
}

.mw-ai-rewrite .text{
    font-size: 12px;
    color: rgba(6,10,24,0.92);
    white-space: pre-wrap;
}

/* copy button */
.mw-ai-copy{
    margin-top: 8px;
    font-size: 12px;
    border: 1px solid rgba(15,23,42,0.10);
    border-radius: 11px;
    padding: 7px 10px;
    background: rgba(249,250,251,0.86);
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.mw-ai-copy:hover{
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(15,23,42,0.12);
    background:
        linear-gradient(135deg, rgba(123,188,255,0.12), rgba(103,232,249,0.08));
}

/* =============================
   REASONS (chips) — glass/light
================================ */

.mw-ai-reasons{
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(210,230,255,0.60);

    background:
        radial-gradient(560px 220px at 15% 0%, rgba(123,188,255,0.08), transparent 60%),
        radial-gradient(420px 220px at 85% 10%, rgba(196,181,253,0.06), transparent 58%),
        linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.66));

    box-shadow: var(--ai-shadow-soft);
}

.mw-ai-reasons-title{
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 8px;
    color: rgba(15,23,42,0.78);
}

.mw-ai-reasons-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 520px){
    .mw-ai-reasons-grid{ grid-template-columns: 1fr; }
}

.mw-ai-reasons-sub{
    font-weight: 800;
    font-size: 12px;
    margin-bottom: 6px;
    color: rgba(15,23,42,0.78);
}

.mw-ai-chips{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mw-ai-chip{
    appearance: none;
    border: 1px solid rgba(15,23,42,0.10);
    background: rgba(255,255,255,0.70);
    color: rgba(15,23,42,0.92);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    transition: transform .05s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.mw-ai-chip:hover{
    background: rgba(255,255,255,0.82);
    box-shadow: 0 10px 18px rgba(15,23,42,0.08);
}

.mw-ai-chip:active{
    transform: scale(.98);
}

.mw-ai-chip.is-active{
    background:
        linear-gradient(135deg, rgba(123,188,255,0.16), rgba(103,232,249,0.12));
    border-color: rgba(123,188,255,0.55);
    color: rgba(6,10,24,0.92);
    box-shadow: 0 10px 18px rgba(15,23,42,0.10);
}

.mw-ai-reasons-other{
    margin-top: 10px;
}

.mw-ai-reason-input{
    width: 100%;
    border: 1px solid rgba(148,163,184,.55);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
    background: rgba(255,255,255,0.78);
    color: rgba(15,23,42,0.92);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}

.mw-ai-reason-input::placeholder{
    color: rgba(15,23,42,0.45);
}

.mw-ai-reason-input:focus{
    border-color: rgba(123,188,255,0.55);
    box-shadow: 0 0 0 4px rgba(123,188,255,0.14);
}

/* ===============================
   Tone selector — unified (matches glass UI)
================================ */

.mw-ai-tone{
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(210,230,255,0.60);

    background:
        radial-gradient(560px 220px at 15% 0%, rgba(123,188,255,0.08), transparent 60%),
        radial-gradient(420px 220px at 85% 10%, rgba(196,181,253,0.06), transparent 58%),
        linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.66));

    box-shadow: var(--ai-shadow-soft);
}

.mw-ai-tone-title{
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
    color: rgba(15,23,42,0.78);
}

.mw-ai-tone-grid{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.mw-ai-tone-btn{
    appearance: none;
    border: 1px solid rgba(15,23,42,0.10);
    background: rgba(255,255,255,0.70);
    color: rgba(15,23,42,0.92);

    padding: 9px 10px;
    border-radius: 12px;

    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;

    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease;
}

.mw-ai-tone-btn:hover{
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(15,23,42,0.12);
    background: rgba(255,255,255,0.82);
}

.mw-ai-tone-btn.is-active{
    background:
        linear-gradient(135deg, rgba(123,188,255,0.16), rgba(103,232,249,0.12));
    border-color: rgba(123,188,255,0.55);
    box-shadow:
        0 12px 22px rgba(15,23,42,0.12),
        inset 0 1px 0 rgba(255,255,255,0.40);
}

/* “Tone не знаю” (если добавишь кнопку) */
.mw-ai-tone-btn--none{
    grid-column: 1 / -1;
    font-weight: 650;
    opacity: .92;
}

/* =============================
   MOBILE
================================ */

@media (max-width: 575.98px){
    .mw-ai-panel{
        width: calc(100vw - 28px);
        right: 14px;
        bottom: 140px;
    }
    .mw-ai-fab{
        right: 20px;
        bottom: 86px;
    }
}

@media (max-width: 420px){
    .mw-ai-tone-grid{ grid-template-columns: 1fr; }
}

/* =============================
   REJECT button (red, safer)
   Target: #mwAiAddRejectedBtn
================================ */

#mwAiAddRejectedBtn{
    border-color: rgba(239,68,68,0.28);
    color: rgba(127,29,29,0.95);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.05)),
        linear-gradient(135deg, rgba(239,68,68,0.14), rgba(244,63,94,0.10));
}

#mwAiAddRejectedBtn:hover{
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(239,68,68,0.18);
    background:
        linear-gradient(135deg, rgba(239,68,68,0.18), rgba(244,63,94,0.14));
}

#mwAiAddRejectedBtn:disabled{
    opacity: .62;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    background: rgba(239,68,68,0.06);
    border-color: rgba(239,68,68,0.18);
}

@keyframes mwWandFloat {
    0%   { transform: translateY(0) rotate(0deg) scale(1); }
    40%  { transform: translateY(-2px) rotate(-6deg) scale(1.05); }
    70%  { transform: translateY(1px)  rotate(5deg)  scale(1.03); }
    100% { transform: translateY(0) rotate(0deg) scale(1); }
}

@keyframes mwWandShine {
    0%, 100% { filter: drop-shadow(0 8px 12px rgba(0,0,0,0.18)); }
    50%      { filter: drop-shadow(0 10px 16px rgba(0,0,0,0.25)); }
}

.mw-ai-fab.is-active i{
    animation-duration: 1.05s;
}
