/* =========================================================
   KAREN — GOVERNMENT EMISSION RESPONSE ASSISTANT
========================================================= */

.gera-assistant,
.gera-assistant * {
    box-sizing: border-box;
}

.gera-assistant {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    color: var(--text, #1b1f23);
}


/* =========================================================
   PRZYCISK OTWIERAJĄCY
========================================================= */

.gera-launcher {
    display: flex;
    align-items: center;
    gap: 10px;

    min-height: 54px;
    padding: 8px 18px 8px 9px;

    border: 1px solid var(--blue-hover, #003d70);
    border-radius: 3px;

    background: var(--blue, #005ea5);
    color: #ffffff;

    font: inherit;
    font-size: 12px;
    font-weight: 700;

    letter-spacing: 0.08em;

    cursor: pointer;

    box-shadow:
        0 5px 18px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.gera-launcher:hover {
    background: var(--blue-hover, #003d70);
}

.gera-launcher:focus-visible {
    outline: 3px solid #ffc400;
    outline-offset: 3px;
}

.gera-launcher-status {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: #ffffff;

    box-shadow:
        0 0 0 3px rgba(98, 255, 157, 0.2),
        0 0 8px rgba(98, 255, 157, 0.8);

    animation: gera-status-pulse 1.4s infinite;
}

.gera-launcher-icon {
    display: grid;
    place-items: center;

    width: 36px;
    height: 36px;

    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 2px;

    background: rgba(0, 0, 0, 0.12);

    font-size: 13px;
    font-weight: 800;
}

.gera-launcher-label {
    white-space: nowrap;
}


/* =========================================================
   OKNO CZATU
========================================================= */

.gera-window {
    position: absolute;
    right: 0;
    bottom: 0;

    display: flex;
    flex-direction: column;

    width: min(390px, calc(100vw - 30px));
    height: min(610px, calc(100vh - 44px));

    overflow: hidden;

    border: 1px solid var(--border, #b1b4b6);
    border-radius: 3px;

    background: var(--background, #f4f5f6);

    box-shadow:
        0 18px 55px rgba(0, 0, 0, 0.3),
        0 0 0 4px rgba(255, 255, 255, 0.65);
}

.gera-window[hidden] {
    display: none;
}


/* =========================================================
   NAGŁÓWEK
========================================================= */

.gera-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;

    min-height: 72px;
    padding: 12px 14px;

    border-bottom: 4px solid #ffc400;

    background: var(--navy-dark, #081c2c);
    color: #ffffff;
}

.gera-identity {
    display: flex;
    align-items: center;
    gap: 11px;

    min-width: 0;
}

.gera-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;

    width: 42px;
    height: 42px;

    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;

    background: var(--blue, #005ea5);

    font-size: 13px;
    font-weight: 800;

    box-shadow:
        inset 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.gera-identity strong {
    display: block;

    margin-bottom: 4px;

    font-size: 15px;
    letter-spacing: 0.08em;
}

.gera-identity span {
    display: block;

    overflow: hidden;

    color: #c4cbd0;

    font-size: 10px;
    line-height: 1.35;

    letter-spacing: 0.04em;
    text-overflow: ellipsis;
}

.gera-close {
    display: grid;
    flex: 0 0 auto;
    place-items: center;

    width: 34px;
    height: 34px;

    padding: 0;

    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 2px;

    background: transparent;
    color: #ffffff;

    font: inherit;
    font-size: 24px;
    line-height: 1;

    cursor: pointer;
}

.gera-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.gera-close:focus-visible {
    outline: 3px solid #ffc400;
    outline-offset: 2px;
}


/* =========================================================
   STATUS SYSTEMU
========================================================= */

.gera-system-status {
    display: flex;
    align-items: center;
    gap: 6px;

    min-height: 36px;
    padding: 8px 14px;

    border-bottom: 1px solid var(--border-light, #d8dde0);

    background: #eef5fa;
    color: var(--text-secondary, #505a63);

    font-size: 9px;
    letter-spacing: 0.08em;
}

.gera-system-status strong {
    color: var(--blue, #005ea5);
}

.gera-online-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--green, #00703c);

    box-shadow:
        0 0 6px rgba(12, 169, 103, 0.7);
}


/* =========================================================
   WIADOMOŚCI
========================================================= */

.gera-messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;

    min-height: 0;
    padding: 16px;

    overflow-x: hidden;
    overflow-y: auto;

    scroll-behavior: smooth;
}

.gera-message {
    width: fit-content;
    max-width: 88%;
}

.gera-message p {
    margin: 0;
    padding: 11px 13px;

    border: 1px solid #ccd7d3;
    border-radius: 2px;

    background: #ffffff;
    color: var(--text, #1b1f23);

    font-size: 13px;
    line-height: 1.55;

    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.05);
}

.gera-message-author {
    display: block;

    margin: 0 0 5px 2px;

    color: var(--text-muted, #6f777b);

    font-size: 8px;
    font-weight: 700;

    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.gera-message-user {
    align-self: flex-end;
}

.gera-message-user .gera-message-author {
    text-align: right;
}

.gera-message-user p {
    border-color: var(--blue-hover, #003d70);

    background: var(--blue, #005ea5);
    color: #ffffff;
}

.gera-message-system {
    align-self: center;

    width: 100%;
    max-width: 100%;
}

.gera-message-system p {
    border-style: dashed;
    border-color: #c8a100;

    background: #fff8cf;
    color: #554600;

    font-size: 11px;
    text-align: center;

    letter-spacing: 0.04em;
}


/* =========================================================
   ANIMACJA PISANIA
========================================================= */

.gera-typing {
    display: flex;
    align-items: center;
    gap: 5px;

    min-height: 38px;
    margin: 0 16px 10px;
    padding: 8px 11px;

    border: 1px dashed var(--border, #b1b4b6);

    background: #eef1f3;
    color: var(--text-muted, #6f777b);
}

.gera-typing[hidden] {
    display: none;
}

.gera-typing span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: var(--blue, #005ea5);

    animation: gera-typing-dot 1s infinite;
}

.gera-typing span:nth-child(2) {
    animation-delay: 0.16s;
}

.gera-typing span:nth-child(3) {
    animation-delay: 0.32s;
}

.gera-typing strong {
    margin-left: 5px;

    font-size: 8px;
    letter-spacing: 0.08em;
}


/* =========================================================
   FORMULARZ
========================================================= */

.gera-form {
    flex: 0 0 auto;

    padding: 12px 14px;

    border-top: 1px solid var(--border-light, #d8dde0);

    background: #eef1f3;
}

.gera-input-label {
    display: block;

    margin-bottom: 6px;

    color: var(--text-secondary, #505a63);

    font-size: 9px;
    font-weight: 700;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gera-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
}

.gera-input {
    width: 100%;
    min-width: 0;
    height: 42px;

    padding: 0 11px;

    border: 1px solid var(--border, #b1b4b6);
    border-radius: 2px;

    background: #ffffff;
    color: var(--text, #1b1f23);

    font: inherit;
    font-size: 12px;
}

.gera-input:focus {
    border-color: var(--blue, #005ea5);
    outline: 2px solid rgba(0, 120, 73, 0.16);
}

.gera-input::placeholder {
    color: var(--text-muted, #6f777b);
}

.gera-send {
    min-width: 68px;
    height: 42px;

    padding: 0 13px;

    border: 1px solid var(--blue-hover, #003d70);
    border-radius: 2px;

    background: var(--blue, #005ea5);
    color: #ffffff;

    font: inherit;
    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.08em;

    cursor: pointer;
}

.gera-send:hover {
    background: var(--blue-hover, #003d70);
}

.gera-send:disabled {
    border-color: var(--border, #b1b4b6);

    background: #b1b4b6;
    color: #505a63;

    cursor: wait;
}


/* =========================================================
   STOPKA CZATU
========================================================= */

.gera-footer {
    display: flex;
    flex: 0 0 auto;
    justify-content: space-between;
    gap: 10px;

    padding: 8px 14px;

    border-top: 1px solid var(--border-light, #d8dde0);

    background: #e8edf1;
    color: #6f777b;

    font-size: 8px;
    letter-spacing: 0.05em;
}


/* =========================================================
   ANIMACJE
========================================================= */

@keyframes gera-status-pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.45;
        transform: scale(0.78);
    }
}

@keyframes gera-typing-dot {
    0%,
    60%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}


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

@media (max-width: 600px) {
    .gera-assistant {
        right: 12px;
        bottom: 12px;
    }

    .gera-window {
        position: fixed;
        inset: 10px;

        width: auto;
        height: auto;
        max-height: none;
    }

    .gera-launcher {
        min-height: 50px;
        padding-right: 14px;
    }

    .gera-launcher-label {
        font-size: 10px;
    }

    .gera-header {
        min-height: 66px;
    }

    .gera-messages {
        padding: 13px;
    }

    .gera-footer {
        flex-direction: column;
        gap: 3px;
    }
}


/* =========================================================
   OGRANICZENIE ANIMACJI
========================================================= */

@media (prefers-reduced-motion: reduce) {
    .gera-launcher-status,
    .gera-typing span {
        animation: none;
    }

    .gera-messages {
        scroll-behavior: auto;
    }
}