/* ================= RESET ================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Arial, sans-serif;
}

body {
    background: #f7f8fa;
    color: #222;
    line-height: 1.4;
}

/* ================= APP WRAPPER ================= */

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ================= HEADER ================= */

#app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

#app-header h1 {
    font-size: 24px;
    font-weight: 600;
}

#create-activity-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

#create-activity-btn:hover {
    background: #1e4fd8;
}

/* ================= ACTIVITY LIST ================= */

#activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ================= ACTIVITY ROW ================= */

.activity-row {
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

/* ---- SUMMARY ---- */

.activity-summary {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: start;
    gap: 16px;
    padding: 16px;
    cursor: pointer;
}

.activity-summary:hover {
    background: #f1f5f9;
}

.activity-arrow {
    font-size: 14px;
    user-select: none;
    line-height: 1;
    margin-top: 2px;
}

.activity-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.activity-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-subtitle {
    font-size: 13px;
    color: #6b7280;
}

.activity-stats {
    font-size: 12px;
    color: #374151;
}

/* ---- ACTION BUTTONS ---- */

.activity-actions {
    display: flex;
    gap: 8px;
}

.activity-actions button {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
}

.activity-actions button:hover {
    background: #f3f4f6;
}

/* ================= EXPANDED ACTIVITY ================= */

.activity-expanded {
    display: none;
    border-top: 1px solid #e5e7eb;
    padding: 16px;
    background: #fafafa;
        max-height: 420px;
        overflow: hidden;
}

.activity-row.expanded .activity-expanded {
    display: block;
}

/* ================= TABLE ================= */

.activity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    /* display: block; */
    max-height: 360px;
    overflow-y: auto;
}

.activity-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
}

.activity-table th,
.activity-table td {
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    white-space: nowrap;
}

.activity-table th {
    background: #f8fafc;
    font-weight: 600;
}

.contact-action-cell {
    text-align: center;
    vertical-align: middle;
}

/* ================= BUTTONS ================= */

.btn {
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-small {
    padding: 4px 8px;
    font-size: 11px;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background: #d1d5db;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================= MODALS ================= */

.hidden {
    display: none !important;
}

/* ================= TRANSCRIPT MODAL ================= */

#transcript-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#transcript-modal.hidden {
    display: none;
}

/* modal card */
#transcript-content {
    background: #ffffff;
    width: 520px;
    max-width: 92%;
    max-height: 70vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* IMPORTANT */
}

/* ---------- HEADER ---------- */

#transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

#transcript-header::before {
    content: "Live Transcription";
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

/* close button */
#close-transcript-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #374151;
    padding: 4px;
}

#close-transcript-btn:hover {
    color: #111827;
}

/* ---------- BODY ---------- */

#transcript-body {
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #ffffff;
}

/* transcript lines */
.transcript-line {
    font-size: 13px;
    line-height: 1.45;
    padding: 8px 10px;
    border-radius: 6px;
    word-wrap: break-word;
}

/* roles */
.transcript-line.role-agent {
    background: #eff6ff;
    color: #1e3a8a;
    align-self: flex-start;
}

.transcript-line.role-user,
.transcript-line.role-human {
    background: #ecfeff;
    color: #155e75;
    align-self: flex-end;
}

.transcript-line.role-system {
    background: #f3f4f6;
    color: #374151;
    font-style: italic;
    align-self: center;
}

/* role label */
.transcript-line strong {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: capitalize;
}
