/* Pocket Doctor Care Desk — original dark UI (not a third-party clone) */
:root {
    --bg-app: #0d1117;
    --bg-sidebar: #010409;
    --bg-elevated: #161b22;
    --bg-hover: #21262d;
    --bg-input: #0d1117;
    --border-color: #30363d;
    --border-soft: #21262d;
    --text-dark: #e6edf3;
    --text-muted: #8b949e;
    --text-faint: #6e7681;
    --accent: #3dd6c6;
    --accent-dim: #1a9e91;
    --accent-soft: rgba(61, 214, 198, 0.12);
    --user-bubble: #1f6feb;
    --primary-blue: #3dd6c6;
    --active-blue: #2bb8aa;
    --light-blue: var(--accent-soft);
    --sidebar-bg: var(--bg-sidebar);
    --bg-light: var(--bg-app);
    --danger: #f85149;
    --warn: #d29922;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg-app);
    color: var(--text-dark);
    min-height: 100vh;
}

.chat-app {
    display: flex;
    min-height: 100vh;
    background: var(--bg-app);
}

.sidebar-backdrop {
    display: none;
}

.chat-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    color: var(--text-dark);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100vh;
    height: 100vh;
    max-height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
    border-right: 1px solid var(--border-soft);
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.chat-brand {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
}

.chat-brand img,
.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.chat-brand i {
    color: var(--accent);
}

.btn-new-chat {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 550;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    font-size: 13px;
    text-decoration: none;
}

.btn-new-chat:hover,
.btn-new-chat.is-active,
a.btn-new-chat.is-active {
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.chat-history-panel {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}

.chat-history-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    padding: 4px 8px;
    flex-shrink: 0;
}

.chat-history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 0%;
    min-height: 0;
    padding-right: 2px;
}

.chat-history-empty {
    font-size: 12px;
    color: var(--text-faint);
    padding: 10px 8px;
    line-height: 1.45;
}

.chat-history-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 9px 10px;
    border-radius: 10px;
    min-width: 0;
    border: 1px solid transparent;
}

.chat-history-item > i {
    margin-top: 2px;
    opacity: 0.7;
    flex-shrink: 0;
}

.chat-history-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.chat-history-title {
    font-weight: 550;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-history-preview {
    font-size: 11px;
    color: var(--text-faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-history-item:hover,
.chat-history-item.active {
    background: var(--bg-hover);
    color: var(--text-dark);
}

.chat-history-item.active {
    border-color: var(--border-color);
}

.sidebar-bottom {
    flex: 0 0 auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    max-height: 52%;
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: 2px;
}

.usage-card {
    flex-shrink: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 11px;
}

.usage-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.usage-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
}

.usage-left {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.usage-bar {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 99px;
    overflow: hidden;
}

.usage-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent));
    border-radius: 99px;
    transition: width 0.25s ease;
}

.usage-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-faint);
}

.usage-meta a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.usage-meta a:hover { text-decoration: underline; }

.top-balance {
    min-width: 160px;
    max-width: 220px;
}

.top-balance-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-bottom: 6px;
}

.top-balance-text strong {
    font-size: 13px;
    color: var(--accent);
}

.top-balance-text span {
    font-size: 11px;
    color: var(--text-muted);
}

.usage-bar-top {
    background: var(--bg-hover);
    height: 5px;
}

.usage-bar-top > span {
    background: linear-gradient(90deg, var(--accent-dim), var(--accent));
}

.chat-side-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
}

.chat-side-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 9px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-side-links a:hover,
.chat-side-links a.is-active {
    background: var(--bg-hover);
    color: var(--text-dark);
}

.chat-side-note {
    font-size: 11px;
    color: var(--text-faint);
    line-height: 1.5;
    flex-shrink: 0;
    padding: 0 4px 4px;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-app);
}

.chat-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(8px);
}

.chat-top h1 {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    color: var(--text-dark);
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    font-size: 15px;
    cursor: pointer;
    color: var(--text-dark);
    flex-shrink: 0;
    margin-left: 4px;
}

.menu-toggle:hover {
    background: var(--bg-hover);
}

.user-chip {
    font-size: 12px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    padding: 6px 11px;
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 28px 20px 12px;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
}

.welcome-block {
    text-align: center;
    padding: 48px 16px 32px;
}

.welcome-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 1px solid rgba(61, 214, 198, 0.25);
}

.welcome-block h2 {
    font-size: 26px;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.welcome-block p {
    color: var(--text-muted);
    max-width: 460px;
    margin: 0 auto 24px;
    font-size: 14px;
    line-height: 1.55;
}

.suggestion-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.suggestion-row button {
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    color: var(--text-dark);
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
}

.suggestion-row button:hover {
    border-color: var(--accent-dim);
    background: var(--bg-hover);
    color: var(--accent);
}

.msg-row {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
    align-items: flex-start;
    width: 100%;
}

.msg-assistant {
    justify-content: flex-start;
}

.msg-user {
    justify-content: flex-end;
}

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}

.msg-user .msg-avatar {
    display: none;
}

.msg-assistant .msg-avatar {
    background: var(--accent-soft);
    color: var(--accent);
    margin-top: 2px;
    border: 1px solid rgba(61, 214, 198, 0.2);
}

.msg-bubble {
    font-size: 15px;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.msg-assistant .msg-bubble {
    flex: 1;
    max-width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 2px 0;
    color: var(--text-dark);
}

.msg-user .msg-bubble {
    max-width: min(85%, 620px);
    margin-left: auto;
    background: var(--user-bubble);
    color: #fff;
    border: none;
    border-radius: 18px;
    padding: 11px 16px;
    text-align: left;
}

.msg-bubble.typing {
    display: flex;
    gap: 5px;
    align-items: center;
    width: fit-content;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border-radius: 14px;
    border: 1px solid var(--border-color);
}

.msg-bubble.typing span {
    width: 6px;
    height: 6px;
    background: var(--text-faint);
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}

.msg-bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.msg-bubble.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-4px); opacity: 1; }
}

.chat-composer {
    padding: 10px 20px 20px;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
}

.composer-box {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 11px 11px 11px 16px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.composer-box:focus-within {
    border-color: var(--accent-dim);
    box-shadow: 0 0 0 1px rgba(61, 214, 198, 0.25);
}

.composer-box textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    line-height: 1.5;
    max-height: 160px;
    min-height: 24px;
    background: transparent;
    color: var(--text-dark);
}

.composer-box textarea::placeholder {
    color: var(--text-faint);
}

.send-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: #04120f;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.send-btn:hover:not(:disabled) {
    background: #5eead4;
}

.composer-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 10px;
}

@media (max-width: 900px) {
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 25;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }

    .chat-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 30;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        box-shadow: 8px 0 28px rgba(0, 0, 0, 0.45);
    }

    .chat-sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: inline-flex;
    }

    .chat-thread,
    .chat-composer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .welcome-block h2 {
        font-size: 22px;
    }
}
