/* ============================================================
   Case Detail Modal
   ============================================================ */

#caseDetailModal .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow: hidden;
}

#caseDetailModal .modal-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.case-detail-info {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.case-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
}

.case-detail-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    min-width: 70px;
    letter-spacing: 0.3px;
}

.status-select {
    padding: 3px 6px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-left: 8px;
    outline: none;
}

/* ============================================================
   Sections
   ============================================================ */

.case-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    margin-top: 8px;
}

.assignee-list {
    padding: 4px 0 8px;
}

.assignee-item {
    padding: 4px 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   Dialogue Container (flex layout: thread scrolls, input pinned)
   ============================================================ */

.dialogue-container {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.dialogue-thread {
    flex: 1;
    min-height: 120px;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dialogue-footer {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    background: var(--surface-color);
    padding-top: 4px;
}

.dialogue-msg {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    max-width: 85%;
    font-size: 13px;
}

.dialogue-msg.mine {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.dialogue-msg.theirs {
    background: var(--bg-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.dialogue-msg.system {
    align-self: center;
    background: transparent;
    text-align: center;
    max-width: 100%;
    padding: 4px 8px;
}

.dialogue-system-text {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.dialogue-author {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 2px;
    opacity: 0.8;
}

.dialogue-msg.mine .dialogue-author {
    color: rgba(255, 255, 255, 0.8);
}

.dialogue-text {
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.dialogue-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.6;
}

.dialogue-msg.mine .dialogue-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
}

/* ============================================================
   Dialogue Input
   ============================================================ */

.dialogue-input {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.dialogue-input textarea {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
}

.dialogue-input textarea:focus {
    border-color: var(--primary-color);
}

/* ============================================================
   Action Buttons (attach file, attach image)
   ============================================================ */

.dialogue-action-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.dialogue-action-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* ============================================================
   File Preview (above input area)
   ============================================================ */

.dialogue-file-preview {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    margin-top: 8px;
    background: var(--bg-color);
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-preview-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
}

.file-preview-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.file-preview-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview-remove {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.file-preview-remove:hover {
    color: var(--danger-color, #ef4444);
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================================
   Dialogue Attachments (in message bubbles)
   ============================================================ */

.dialogue-attachment {
    margin: 4px 0;
}

.dialogue-img {
    max-width: 220px;
    max-height: 180px;
    border-radius: 6px;
    cursor: pointer;
    display: block;
    object-fit: cover;
}

.dialogue-msg.mine .dialogue-img {
    margin-left: auto;
}

.dialogue-file-link a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.dialogue-msg.mine .dialogue-file-link a {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.dialogue-file-link a:hover {
    background: rgba(0, 0, 0, 0.1);
}

.dialogue-msg.mine .dialogue-file-link a:hover {
    background: rgba(255, 255, 255, 0.25);
}

.dialogue-file-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.dialogue-file-name {
    font-size: 12px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Lightbox (fullscreen image preview)
   ============================================================ */

.dialogue-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dialogue-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

/* ============================================================
   Camera Modal
   ============================================================ */

.camera-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-modal__content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.camera-modal__preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.camera-modal__preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.camera-modal__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.6);
}

.camera-modal__btn {
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.camera-modal__btn--close,
.camera-modal__btn--switch {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
}

.camera-modal__btn--close:hover,
.camera-modal__btn--switch:hover {
    background: rgba(255, 255, 255, 0.25);
}

.camera-modal__btn--capture {
    width: 70px;
    height: 70px;
    border: 4px solid white;
    padding: 4px;
}

.camera-modal__btn--capture:hover .camera-modal__capture-ring {
    background: rgba(255, 255, 255, 0.8);
}

.camera-modal__capture-ring {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: white;
    transition: background 0.15s;
}
