﻿/* wwwroot/css/chat.css */

/* ================================
   SHARED
   ================================ */

.dotc-hidden {
    display: none !important;
}

.dotc-widget {
    font-family: var(--font-utility);
    z-index: 9999;
}

.dotc-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    z-index: 9999;
}

    .dotc-fab:hover {
        transform: scale(1.08);
        box-shadow: 0 0 28px rgba(255, 111, 60, 0.6);
    }

.dotc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.125rem;
    background: rgba(10, 10, 10, 0.98);
    border-bottom: 1px solid rgba(255, 111, 60, 0.2);
    flex-shrink: 0;
}

.dotc-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dotc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.dotc-header-title {
    font-family: var(--font-personality);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.dotc-header-sub {
    font-size: 0.75rem;
    color: var(--primary-orange);
    line-height: 1.2;
}

.dotc-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast), background var(--transition-fast);
}

    .dotc-icon-btn:hover {
        color: var(--primary-orange);
        background: rgba(255, 111, 60, 0.1);
    }

.dotc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.125rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    overscroll-behavior: contain;
}

    .dotc-messages::-webkit-scrollbar {
        width: 4px;
    }

    .dotc-messages::-webkit-scrollbar-track {
        background: transparent;
    }

    .dotc-messages::-webkit-scrollbar-thumb {
        background: rgba(255, 111, 60, 0.25);
        border-radius: 2px;
    }

.dotc-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: dotcFadeUp 0.2s ease;
}

    .dotc-msg.user {
        align-self: flex-end;
    }

    .dotc-msg.assistant {
        align-self: flex-start;
    }

.dotc-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1.125rem;
    font-size: 0.9rem;
    line-height: 1.7;
    word-break: break-word;
}

.dotc-msg.user .dotc-bubble {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.dotc-msg.assistant .dotc-bubble {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid rgba(255, 111, 60, 0.15);
    border-bottom-left-radius: 0.25rem;
}

.dotc-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.125rem;
    background: var(--darker-bg);
    border-top: 1px solid rgba(255, 111, 60, 0.1);
    flex-shrink: 0;
}

.dotc-input {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid rgba(255, 111, 60, 0.2);
    color: var(--text-primary);
    padding: 0.6rem 0.875rem;
    border-radius: 1.5rem;
    outline: none;
    font-size: 0.9rem;
    font-family: var(--font-utility);
    transition: border-color var(--transition-fast);
}

    .dotc-input:focus {
        border-color: var(--primary-orange);
    }

    .dotc-input::placeholder {
        color: var(--text-muted);
    }

.dotc-send-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

    .dotc-send-btn:hover {
        transform: scale(1.08);
    }

    .dotc-send-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        transform: none;
    }

/* Disclaimer */
.dotc-disclaimer {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

    .dotc-disclaimer p {
        font-size: 0.85rem;
        line-height: 1.6;
        color: var(--text-secondary);
        margin: 0;
    }

.dotc-disclaimer-btn {
    font-family: var(--font-personality);
    font-weight: 600;
    font-size: 0.85rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 1.5rem;
    padding: 0.55rem 1.25rem;
    cursor: pointer;
    align-self: flex-start;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

    .dotc-disclaimer-btn:hover:not(:disabled) {
        transform: translateY(-1px);
    }

    .dotc-disclaimer-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

@keyframes dotcFadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   DESKTOP WINDOW
   ================================ */

.dotc-window {
    position: fixed;
    bottom: 5.5rem;
    right: 2rem;
    width: 400px;
    height: 600px;
    display: flex;
    flex-direction: column;
    background: var(--dark-bg);
    border-radius: 1.25rem;
    border: 1px solid rgba(255, 111, 60, 0.15);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 111, 60, 0.08);
    overflow: hidden;
    animation: dotcPopUp 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9998;
}

    .dotc-window .dotc-header {
        border-radius: 1.25rem 1.25rem 0 0;
    }

@keyframes dotcPopUp {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
        transform-origin: bottom right;
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ================================
   MOBILE BOTTOM SHEET
   ================================ */

.dotc-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9997;
    animation: dotcFadeIn 0.2s ease;
}

@keyframes dotcFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.dotc-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 88vh;
    display: flex;
    flex-direction: column;
    background: var(--dark-bg);
    border-radius: 1.25rem 1.25rem 0 0;
    border-top: 1px solid rgba(255, 111, 60, 0.2);
    border-left: 1px solid rgba(255, 111, 60, 0.1);
    border-right: 1px solid rgba(255, 111, 60, 0.1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 9998;
    animation: dotcSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Keep the sheet above the keyboard using visualViewport in JS */
}

@keyframes dotcSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.dotc-sheet-handle-row {
    display: flex;
    justify-content: center;
    padding: 0.6rem 0 0.25rem;
    flex-shrink: 0;
}

.dotc-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 111, 60, 0.3);
}

.dotc-sheet-messages {
    -webkit-overflow-scrolling: touch;
}

.dotc-sheet-input-row {
    /* Extra bottom padding for home indicator on notched phones */
    padding-bottom: calc(0.875rem + env(safe-area-inset-bottom, 0px));
}

/* ================================
   RESPONSIVE: show/hide correct UI
   ================================ */

/* Desktop: hide sheet elements, show window */
@media (min-width: 481px) {
    .dotc-sheet,
    .dotc-sheet-backdrop {
        display: none !important;
    }
}

/* Mobile: hide window, sheet is used instead */
@media (max-width: 480px) {
    .dotc-window {
        display: none !important;
    }

    .dotc-fab {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 54px;
        height: 54px;
    }
}
