/* ==========================================================================
   Maria Demir Chat Widget - DGD Portal
   v2.0 - Maria-First Redesign
   Colors: Gold #D4A843, Dunkelblau #1A365D, Weiss #FFFFFF, Hellgrau #F4F4F8
   ========================================================================== */

/* Hidden state */
.maria-hidden {
    display: none !important;
}

/* ---- FAB Button (Upgraded: 64px, avatar, label) ---- */
.maria-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #D4A843 0%, #b8912e 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(26, 54, 93, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.maria-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(26, 54, 93, 0.45);
}

.maria-fab--open {
    transform: scale(0);
    pointer-events: none;
}

/* Avatar image in FAB */
.maria-fab__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
    filter: brightness(0) invert(1);
    pointer-events: none;
}

/* Pulse ring */
.maria-fab__pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(212, 168, 67, 0.3);
    animation: maria-pulse 2.5s ease-out infinite;
    pointer-events: none;
}

@keyframes maria-pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* "Maria" label next to FAB */
.maria-fab__label {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    color: #1A365D;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    pointer-events: none;
    transition: opacity 0.4s, transform 0.4s;
}

.maria-fab__label--hidden {
    opacity: 0;
    transform: translateY(-50%) translateX(10px);
}

/* ---- Chat Panel (Upgraded: 440x560) ---- */
.maria-chat {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 440px;
    height: 560px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(26, 54, 93, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: maria-slideUp 0.25s ease-out;
}

@keyframes maria-slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Header (with subtitle) ---- */
.maria-chat__header {
    background: linear-gradient(135deg, #1A365D 0%, #2a4a7f 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.maria-chat__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}

.maria-chat__title-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.maria-chat__subtitle {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.7;
}

.maria-chat__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    flex-shrink: 0;
}

.maria-chat__dot--online {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.maria-chat__dot--offline {
    background: #fbbf24;
}

.maria-chat__status {
    font-size: 11px;
    opacity: 0.7;
    margin-left: auto;
    padding-left: 8px;
}

.maria-chat__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.maria-chat__close:hover {
    opacity: 1;
}

/* ---- Messages ---- */
.maria-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #F4F4F8;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.maria-msg {
    display: flex;
    max-width: 85%;
}

.maria-msg--maria {
    align-self: flex-start;
}

.maria-msg--user {
    align-self: flex-end;
}

.maria-msg__bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-line;
}

.maria-msg--maria .maria-msg__bubble {
    background: #FFFFFF;
    color: #1A365D;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.maria-msg--user .maria-msg__bubble {
    background: #1A365D;
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

/* ---- Quick Action Buttons ---- */
.maria-quick-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.maria-quick-btn {
    padding: 7px 14px;
    border: 1.5px solid #D4A843;
    border-radius: 20px;
    background: #fff;
    color: #1A365D;
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    white-space: nowrap;
}

.maria-quick-btn:hover {
    background: #D4A843;
    color: #fff;
    transform: translateY(-1px);
}

/* ---- Action Button (navigate after fallback) ---- */
.maria-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #D4A843 0%, #b8912e 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(212, 168, 67, 0.3);
}

.maria-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 168, 67, 0.4);
}

/* ---- Typing Indicator ---- */
.maria-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
}

.maria-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #1A365D;
    opacity: 0.4;
    animation: maria-typingDot 1.2s ease-in-out infinite;
}

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

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

@keyframes maria-typingDot {
    0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* ---- Input ---- */
.maria-chat__input {
    display: flex;
    padding: 12px;
    gap: 8px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.maria-chat__input input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.maria-chat__input input:focus {
    border-color: #D4A843;
}

.maria-chat__input input:disabled {
    background: #f3f4f6;
}

.maria-chat__send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #D4A843;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.maria-chat__send:hover:not(:disabled) {
    background: #b8912e;
}

.maria-chat__send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* ---- Responsive: mobile full-width ---- */
@media (max-width: 480px) {
    .maria-chat {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .maria-fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .maria-fab__label {
        display: none;
    }

    .maria-fab__avatar {
        width: 28px;
        height: 28px;
    }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .maria-fab__pulse,
    .maria-chat,
    .maria-typing span {
        animation: none;
    }
}
