/* AutoResponse Dashboard Styles - Modern Design */

:root {
    --primary-color: #1e2a38;
    --secondary-color: #4b535d;
    --accent-color: #2c3e50;
    --spam-red: #dc3545;
    --response-blue: #0d6efd;
    --bg-light: #f5f5f5;
    --bg-card: #ffffff;
    --shadow-subtle: 0 4px 30px rgba(0, 0, 0, 0.05);
    --transition-fast: all 0.2s ease;
    --navbar-height: 56px;
}

html, body {
    height: 100vh;
    overflow: hidden;
    background: var(--bg-light);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    z-index: 1030;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

/* ── Main wrapper ────────────────────────────────────────── */
.main-wrapper {
    position: fixed;
    top: var(--navbar-height);
    left: 0; right: 0; bottom: 0;
    padding: 1rem;
    overflow: hidden;
}

/* ── App layout: sidebar + detail ───────────────────────── */
.app-layout {
    display: flex;
    gap: 1rem;
    height: 100%;
}

.sidebar-panel {
    flex: 0 0 320px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.detail-panel {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Panel card (shared by both sides) ──────────────────── */
.panel-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: var(--shadow-subtle);
    overflow: hidden;
}

.panel-header {
    flex-shrink: 0;
    background: var(--bg-light);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1rem 1.25rem;
    color: var(--primary-color);
    font-weight: 600;
}

.panel-header h5 {
    font-weight: 600;
    color: var(--primary-color);
}

.panel-body {
    flex: 1 1 0;
    overflow-y: auto;
    min-height: 0;
}

/* ── Thread list items ───────────────────────────────────── */
.thread-item {
    cursor: pointer;
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.thread-item:hover { background-color: #f9f9f9; }

.thread-item.active {
    background: #ffffff;
    border-left-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.thread-item.status-active  { border-left-color: #28a745; }
.thread-item.status-paused  { border-left-color: #ffc107; }
.thread-item.status-archived { border-left-color: #6c757d; }

.thread-subject {
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-sender {
    color: #6c757d;
    font-size: 0.875em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.82em;
    color: #6c757d;
}

/* ── Chat Bubble Messages ─────────────────────────────────── */
.chat-area {
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    max-width: 100%;
}

.bubble-row.inbound  { flex-direction: row; }
.bubble-row.outbound { flex-direction: row-reverse; }

.bubble-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 1.2rem;
}

.bubble-avatar.inbound  { background: #fee2e2; color: #dc2626; }
.bubble-avatar.outbound { background: #dbeafe; color: #2563eb; }

.bubble-content {
    max-width: 74%;
    min-width: 0;
}

.bubble {
    padding: 0.75rem 1.1rem;
    border-radius: 18px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
    font-size: 0.94rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    position: relative;
}

.bubble.inbound {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 5px;
}

.bubble.outbound {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a5f;
    border-bottom-right-radius: 5px;
}

.bubble p { margin: 0 0 0.6em 0; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong, .bubble b { font-weight: 600; }

.bubble-meta {
    font-size: 0.72rem;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
}

.bubble-row.inbound  .bubble-meta { text-align: left; }
.bubble-row.outbound .bubble-meta { text-align: right; }

/* Quote toggle button */
.quote-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: #6b7280;
    cursor: pointer;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    margin-top: 0.6rem;
    transition: background 0.15s;
}
.quote-toggle:hover { background: rgba(0, 0, 0, 0.1); }

/* Quoted / original message (collapsed by default) */
.quoted-content {
    margin-top: 0.6rem;
    padding: 0.65rem 0.9rem;
    background: rgba(0, 0, 0, 0.04);
    border-left: 3px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #6b7280;
    display: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}
.quoted-content.expanded { display: block; }

/* Styled blockquotes from > email quote markers */
.bubble blockquote.email-quote {
    border-left: 3px solid #d1d5db;
    padding: 0.3rem 0.75rem;
    margin: 0.4rem 0;
    color: #6b7280;
    font-size: 0.88rem;
    background: rgba(0,0,0,0.03);
    border-radius: 2px;
}

/* ── Misc ────────────────────────────────────────────────── */
.status-badge {
    font-size: 0.75em;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 500;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 991px) {
    html, body { overflow: auto; height: auto; }

    .main-wrapper {
        position: static;
        padding: calc(var(--navbar-height) + 1rem) 0.75rem 1rem;
        overflow: visible;
    }

    .app-layout {
        flex-direction: column;
        height: auto;
    }

    .sidebar-panel, .detail-panel { flex: none; }

    .panel-card {
        height: auto;
        max-height: 60vh;
    }

    .panel-body { max-height: 50vh; overflow-y: auto; }
}

