/* ============================================================
   Admin Modal Styles
   Extracted from style.css without selector renames.
   ============================================================ */

/* ── User Management Modal ─────────────────────────────────── */

/* Modal chrome */
#user-management-modal {
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

#user-management-modal .modal-header {
    padding: 1rem 1.5rem 0.9rem;
    margin-bottom: 0;
    border-bottom: 2px solid var(--primary-color, #0056b3);
    background: #fff;
}

#user-management-modal .modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color, #0056b3);
    letter-spacing: 0.01em;
}

#user-management-modal .modal-header button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-secondary, #5f6368);
    transition: background 0.15s, color 0.15s;
}

#user-management-modal .modal-header button:hover {
    background: #f0f4ff;
    color: var(--primary-color, #0056b3);
}

#user-management-modal .modal-body {
    padding: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#user-management-modal .modal-footer {
    padding: 0.85rem 1.5rem;
    background: #fafbfd;
    border-top: 1px solid var(--border-color, #d1d9e0);
}

/* Search / filter bar */
.user-search-container {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #d1d9e0);
    flex-shrink: 0;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    background: #fafbfd;
}

.user-search-input {
    flex: 1;
    padding: 0.5rem 0.9rem;
    font-size: 0.875rem;
    font-family: var(--font-family);
    border: 1px solid var(--border-color, #d1d9e0);
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary, #202124);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.user-search-input:focus {
    outline: none;
    border-color: var(--primary-color, #0056b3);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

.user-role-filter,
.user-cohort-filter {
    min-width: 130px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--font-family);
    border: 1px solid var(--border-color, #d1d9e0);
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary, #202124);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.user-role-filter:focus,
.user-cohort-filter:focus {
    outline: none;
    border-color: var(--primary-color, #0056b3);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

.um-manage-cohorts-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    font-family: var(--font-family);
    border: 1px solid var(--border-color, #d1d9e0);
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary, #202124);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s;
}

.um-manage-cohorts-btn:hover {
    background: #f1f3f5;
    border-color: var(--primary-color, #0056b3);
}

.cohort-manage-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border-color, #d1d9e0);
    border-radius: 6px;
    background: #fff;
}

.cohort-manage-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--border-color, #eef0f3);
    font-size: 0.9rem;
}

.cohort-manage-list li:last-child {
    border-bottom: none;
}

.cohort-manage-list .cohort-value {
    color: var(--text-primary, #202124);
}

.cohort-manage-list .cohort-delete-btn {
    background: none;
    border: 1px solid transparent;
    color: #c0392b;
    cursor: pointer;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: background-color 0.15s, border-color 0.15s;
}

.cohort-manage-list .cohort-delete-btn:hover:not(:disabled) {
    background: #fdecea;
    border-color: #f5c6c0;
}

.cohort-manage-list .cohort-delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cohort-manage-list .cohort-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary, #5f6368);
    font-size: 0.85rem;
}

#user-list-container {
    overflow: auto;
    flex-grow: 1;
}

/* Pagination */
#pagination-container {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color, #d1d9e0);
    flex-shrink: 0;
    background: #fafbfd;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-auto-flow: dense;
    align-items: center;
    gap: 0.75rem;
}

#pagination-container .pagination-info {
    color: var(--text-secondary, #5f6368);
    font-size: 0.82rem;
    font-weight: normal;
    margin: 0;
    grid-column: 3;
    justify-self: end;
    text-align: right;
}

#pagination-container .pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    grid-column: 2;
    justify-self: center;
}

.pagination-btn {
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border-color, #d1d9e0);
    background: #fff;
    color: var(--text-primary, #202124);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: var(--font-family);
    min-width: 34px;
    text-align: center;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #f0f4ff;
    border-color: var(--primary-color, #0056b3);
    color: var(--primary-color, #0056b3);
}

.pagination-btn.active {
    background: var(--primary-color, #0056b3);
    color: #fff;
    border-color: var(--primary-color, #0056b3);
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    color: var(--text-secondary, #5f6368);
}

.pagination-ellipsis {
    padding: 0.35rem 0.2rem;
    color: var(--text-secondary, #5f6368);
    font-size: 0.82rem;
}

/* User management table – EHR-style */
.user-management-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    font-family: var(--font-family);
}

.user-management-table thead tr {
    background: #fff;
    color: #2e4da3;
    border-bottom: 2px solid #2e4da3;
}

.user-management-table th {
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 0.82rem;
    text-align: left;
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    white-space: nowrap;
}

.user-management-table th.checkbox-column {
    width: 38px;
    text-align: center;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.user-management-table th:nth-child(2) {
    min-width: 180px;
}

.user-management-table th:nth-child(3),
.user-management-table th:nth-child(4) {
    min-width: 110px;
}

.user-management-table tbody tr {
    border-bottom: 1px solid var(--border-color, #d1d9e0);
    transition: background 0.12s;
}

.user-management-table tbody tr:hover {
    background: #f0f4ff;
}

.user-management-table td {
    padding: 0.6rem 1rem;
    text-align: left;
    vertical-align: middle;
    color: var(--text-primary, #202124);
}

.user-management-table td.checkbox-column {
    text-align: center;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* Inline select controls in table */
.um-inline-select {
    font-size: 0.82rem;
    font-family: var(--font-family);
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color, #d1d9e0);
    border-radius: 5px;
    background: #fff;
    color: var(--text-primary, #202124);
    cursor: pointer;
    transition: border-color 0.15s;
    width: 100%;
}

.um-inline-select:focus {
    outline: none;
    border-color: var(--primary-color, #0056b3);
    box-shadow: 0 0 0 2px rgba(0, 86, 179, 0.1);
}

/* Inline name input in table */
.um-inline-input {
    font-size: 0.82rem;
    font-family: var(--font-family);
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-primary, #202124);
    width: 100%;
    transition: border-color 0.15s, background 0.15s;
}

.um-inline-input:hover {
    border-color: var(--border-color, #d1d9e0);
    background: #fff;
}

.um-inline-input:focus {
    outline: none;
    border-color: var(--primary-color, #0056b3);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 86, 179, 0.1);
}

/* Email-verified badges */
.um-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.um-badge-verified {
    background: #e6f4ea;
    color: #1e7e34;
}

.um-badge-unverified {
    background: #fdecea;
    color: #c0392b;
}

/* Action trigger button in table */
.um-action-trigger {
    width: 30px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color, #d1d9e0);
    border-radius: 5px;
    background: #fff;
    color: var(--text-secondary, #5f6368);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.um-action-trigger:hover {
    background: #f0f4ff;
    border-color: var(--primary-color, #0056b3);
    color: var(--primary-color, #0056b3);
}

.um-action-trigger.active {
    background: #f0f4ff;
    border-color: var(--primary-color, #0056b3);
    color: var(--primary-color, #0056b3);
}

/* Dropdown menu (body-appended, fixed position) */
.um-action-dropdown-menu {
    position: fixed;
    background: #fff;
    border: 1px solid var(--border-color, #d1d9e0);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
    min-width: 168px;
    z-index: 99999;
    display: none;
    overflow: hidden;
    padding: 0.3rem 0;
}

.um-action-dropdown-menu.visible {
    display: block;
    animation: um-dropdown-in 0.12s ease;
}

@keyframes um-dropdown-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.um-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    font-family: var(--font-family);
    font-weight: 500;
    color: var(--text-primary, #202124);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
    white-space: nowrap;
}

.um-dropdown-item:hover:not(:disabled) {
    background: #f0f4ff;
    color: var(--primary-color, #0056b3);
}

.um-dropdown-item.danger {
    color: #c0392b;
}

.um-dropdown-item.danger:hover:not(:disabled) {
    background: #fdecea;
    color: #a51824;
}

.um-dropdown-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.um-dropdown-divider {
    height: 1px;
    background: var(--border-color, #d1d9e0);
    margin: 0.25rem 0;
}

/* Inline verify button inside badge cell */
.um-verify-inline-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-family);
    border-radius: 5px;
    border: 1px solid var(--primary-color, #0056b3);
    background: transparent;
    color: var(--primary-color, #0056b3);
    cursor: pointer;
    margin-left: 0.4rem;
    transition: all 0.15s ease;
}

.um-verify-inline-btn:hover:not(:disabled) {
    background: var(--primary-color, #0056b3);
    color: #fff;
}

/* Sortable header styles */
.user-management-table .sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.user-management-table .sortable-header:hover {
    background: #f0f4ff;
    color: var(--primary-color, #0056b3);
}

.user-management-table .sort-indicator {
    display: inline-block;
    margin-left: 0.3rem;
    font-size: 0.7rem;
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.user-management-table .sort-indicator.active {
    opacity: 1;
    color: var(--primary-color, #0056b3);
    font-weight: bold;
}

.user-management-table .sortable-header:hover .sort-indicator {
    opacity: 0.8;
}

/* ── Dialog Modal base (dm-*) – used by message, input, textarea, teacher-reset modals ── */
.dm-modal {
    background: var(--panel-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    max-width: 460px;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e4ea;
    text-align: left;
    max-height: 90vh;
}

.dm-modal.wide { max-width: 560px; }

.dm-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #d1d9e0);
    background: #f8fafc;
    flex-shrink: 0;
}

.dm-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dm-header-icon.info {
    background: rgba(0, 86, 179, 0.1);
    color: var(--primary-color, #0056b3);
}

.dm-header-icon.warn {
    background: #fffbeb;
    color: #d97706;
}

.dm-header-icon.danger {
    background: #fef2f2;
    color: #dc2626;
}

.dm-header h3 {
    font-size: 0.975rem;
    font-weight: 600;
    color: var(--text-primary, #202124);
    margin: 0;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.dm-body {
    padding: 1.25rem 1.5rem;
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
    line-height: 1.6;
}

.dm-body p {
    margin: 0 0 0.8rem;
    color: var(--text-primary, #202124);
    font-size: 0.9rem;
}

.dm-body p:last-child { margin-bottom: 0; }

.dm-body p.muted {
    color: var(--text-secondary, #5f6368);
    font-size: 0.85rem;
}

.dm-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-top: 1px solid var(--border-color, #d1d9e0);
    background: #f8fafc;
    flex-shrink: 0;
}

/* ── Case Attempts Modal (cam-*) ── */
.cam-modal {
    background: var(--panel-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    max-width: 460px;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e4ea;
}

.cam-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color, #d1d9e0);
    background: #f8fafc;
}

.cam-header-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(0, 86, 179, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary-color, #0056b3);
}

.cam-header-text {
    flex: 1;
    min-width: 0;
}

.cam-header-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #202124);
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.cam-header-type {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    background: #e8f0fe;
    color: #1a73e8;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.cam-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cam-case-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.cam-case-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary, #202124);
    margin: 0;
    line-height: 1.35;
}

.cam-case-desc {
    font-size: 0.875rem;
    color: var(--text-secondary, #5f6368);
    margin: 0;
}

.cam-stats-panel {
    background: #f8fafc;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    overflow: hidden;
}

.cam-stats {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    align-items: stretch;
    padding: 1.1rem 0 0.9rem;
}

.cam-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0 1.25rem;
}

.cam-stat-divider {
    width: 1px;
    background: #e0e4ea;
    margin: 0.25rem 0;
}

.cam-stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary, #202124);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.cam-stat-value.success { color: #1a7340; }
.cam-stat-value.warning { color: #b45309; }
.cam-stat-value.danger  { color: #c0392b; }

.cam-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary, #5f6368);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cam-max-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-top: 1px solid #e8eaed;
    font-size: 0.78rem;
    color: var(--text-secondary, #5f6368);
    background: #f0f3f8;
}

.cam-confirm-text {
    font-size: 0.875rem;
    color: var(--text-secondary, #5f6368);
    margin: 0;
    line-height: 1.5;
}

.cam-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-top: 1px solid var(--border-color, #d1d9e0);
    background: #f8fafc;
}

/* Comparison Modal Styles */
.confirmation-modal.comparison-modal {
    max-width: 80vw;
}

.comparison-panels {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 0;
    overflow: hidden;
}

.comparison-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    min-height: 0;
    min-width: 0;
}

.comparison-panel:last-child {
    border-right: none;
}

.comparison-panel-header {
    padding: 0.75rem 1rem;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.comparison-panel-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.comparison-panel-body {
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    background-color: var(--panel-bg);
}

.comparison-panel-body .markdown-rendered-content {
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: left;
}

/* Diff highlighting styles - block-based */
.diff-block-added {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
    padding: 0.5rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    text-align: left;
}

.diff-block-added > *:first-child {
    margin-top: 0;
}

.diff-block-added > *:last-child {
    margin-bottom: 0;
}

.diff-block-removed {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    padding: 0.5rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    opacity: 0.8;
    text-align: left;
}

.diff-block-removed > *:first-child {
    margin-top: 0;
}

.diff-block-removed > *:last-child {
    margin-bottom: 0;
}

.diff-block-unchanged {
    text-align: left;
}

.diff-block-unchanged > *:first-child {
    margin-top: 0;
}

.diff-block-unchanged > *:last-child {
    margin-bottom: 0;
}


/* Styles for Admin Case Review Data */
.review-data-container {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
}
.review-data-list {
    padding-left: 1rem;
    margin: 0;
}
.review-data-list dt {
    font-weight: 600;
    color: #343a40;
    margin-top: 0.75rem;
}
.review-data-list dd {
    margin-left: 1rem;
    margin-bottom: 0.5rem;
}
.review-data-value {
    color: #495057;
    white-space: pre-wrap; /* Wrap long lines */
    word-break: break-word;
}
.review-data-value-pre {
    background-color: #f8f9fa; /* A slightly different background for pre blocks */
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.5rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.9em;
    max-height: 200px; /* Prevent super long prompts from taking over */
    overflow-y: auto;
}
.review-data-array {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin: 0;
}
.review-data-array li {
    margin-bottom: 0.5rem;
}

/* Admin Modal Editor Table Styles */
.json-editor-container {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
}

.key-value-pair {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.key-value-pair:last-child {
    margin-bottom: 0;
}

.key-value-pair label {
    font-weight: 500;
    text-align: right;
    color: #495057;
}

.editor-section {
    border: 1px solid #d1d9e0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #fff;
}

.editor-section:last-child {
    margin-bottom: 0;
}

.editor-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.editor-section-header span {
    font-weight: 600;
    color: var(--primary-color);
}

.editor-section label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #343a40;
    display: block;
}

.editor-section input[type="text"],
.editor-section input[type="datetime-local"],
.editor-section textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 1rem;
}

.editor-section input[type="text"]:focus,
.editor-section input[type="datetime-local"]:focus,
.editor-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.2);
}

.editor-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    table-layout: fixed;
}

.editor-table th,
.editor-table td {
    border: none;
    border-bottom: 1px solid #e9ecef; /* Horizontal lines only */
    padding: 0;
    text-align: left;
    vertical-align: middle;
}

.editor-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
    color: #495057;
    border-bottom: 2px solid #dee2e6; /* Stronger header divider */
}

.editor-table input[type="text"] {
    width: 100%;
    border: none !important; /* Force removal of borders */
    box-shadow: none !important; /* Remove any default shadows */
    padding: 0.4rem 0.5rem;
    border-radius: 0;
    background-color: transparent;
    font-size: 0.85rem;
    line-height: 1.4;
    height: 100%;
    display: block;
    margin: 0;
}

.editor-table input[type="text"]:focus {
    outline: none;
    background-color: #f1f3f5; /* Subtle background highlight instead of border */
    position: relative;
    z-index: 1;
}

.editor-table th:last-child,
.editor-table td:last-child {
    width: 32px;
    text-align: center;
    padding: 0;
}

.editor-table td:last-child {
    vertical-align: middle;
}

/* Specific widths for lab results to ensure compact layout */
.lab-results-table th:nth-child(1) { width: 30%; }
.lab-results-table th:nth-child(2) { width: 20%; }
.lab-results-table th:nth-child(3) { width: auto; }

.delete-row-btn {
    background-color: transparent;
    color: #adb5bd;
    border: none;
    border-radius: 4px; /* Square button looks more technical/compact */
    width: 24px;
    height: 24px;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.delete-row-btn:hover {
    background-color: #ffe3e3;
    color: #e03131;
}

.add-row-btn {
    margin-top: 1rem;
    padding: 0.65rem 1rem;
    border: none;
    background-color: #e8f5e9;
    color: #2e7d32;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    font-family: var(--font-family);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    text-align: center;
    box-shadow: none;
}

.add-row-btn:hover {
    background-color: #c8e6c9;
    color: #1b5e20;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(46, 125, 50, 0.15);
}

.add-row-btn:active {
    transform: scale(0.98);
    box-shadow: none;
    background-color: #a5d6a7;
}

.delete-row-btn {
    background-color: transparent;
    color: #6c757d;
    border: 1px solid transparent;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 1.1rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.delete-row-btn:hover {
    background-color: #f8d7da;
    color: var(--danger-color);
    border-color: var(--danger-color);
}

/* Styles for range slider in admin modal */
.range-slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.range-slider-container .range-slider-value {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Speaking rate sliders: keep value on the same row by making the slider a bit shorter */
.range-slider-container input[type="range"].speaking-rate-slider {
    flex: 0 1 240px;
    width: 240px;
    max-width: 240px;
}

.range-slider-container input[type="range"] {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 5px;
    outline: none;
    opacity: 0.8;
    transition: opacity .2s;
}

.range-slider-container input[type="range"]:hover {
    opacity: 1;
}

.range-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
}

.range-slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.range-slider-value {
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Pro Display', 'Inter', system-ui, sans-serif;
    min-width: 3em; /* Reserve space for "1.50" */
    text-align: left;
    color: #495057;
}

/* Lab Test Editor Section in Admin Modal */
.lab-test-editor-section .add-lab-result-btn {
    width: auto; /* Don't make it full width */
    display: inline-block;
}
.lab-test-editor-section .lab-test-notes {
    min-height: 80px;
}
#add-lab-test-btn {
    margin-top: 1rem;
}

/* Attachment Editor Section Styles */
.attachment-editor-section .attachment-url {
    font-family: monospace;
}
.attachment-editor-section .attachment-description,
.attachment-editor-section .attachment-instructions {
    min-height: 80px;
    resize: vertical;
}
.attachment-editor-section .attachment-preview {
    padding: 1rem 1.25rem;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    background-color: #fafbff;
    margin-bottom: 0;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #64748b;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
.attachment-editor-section .attachment-preview:hover {
    border-color: var(--primary-color);
    background-color: #f4f8ff;
}
.attachment-editor-section .attachment-preview:not(:has(.attachment-filename))::before {
    content: "";
    display: inline-block;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><polyline points='17 8 12 3 7 8'/><line x1='12' y1='3' x2='12' y2='15'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
}
.attachment-editor-section .attachment-preview p {
    margin: 0;
    font-size: 0.9rem;
}
.attachment-editor-section .attachment-preview:has(.attachment-filename) {
    border: 1px solid #e5e7eb;
    background-color: #ffffff;
    color: #1f2937;
}
.attachment-editor-section .attachment-filename {
    margin: 0;
    color: #1f2937;
    font-weight: 500;
    font-size: 0.95rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-editor-section .attachment-link {
    color: #4b5563;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 4px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}
.attachment-editor-section .attachment-link:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
    text-decoration: none;
}
.attachment-editor-section .upload-attachment-btn {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}
.attachment-editor-section .upload-attachment-btn:hover {
    background-color: #004a99;
}
.attachment-editor-section .upload-attachment-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}
.attachment-editor-section .upload-status-display {
    margin-left: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}
#add-attachment-btn {
    margin-top: 1rem;
}

/* Admin Modal Editor Form Styles */
.case-editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Compact layout for guest event forms */
.guest-event-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

#create-event-view .form-field {
    margin-bottom: 0;
}

#create-event-view .form-field label {
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
}

#create-event-view .form-field input[type="text"],
#create-event-view .form-field input[type="number"],
#create-event-view .form-field input[type="date"],
#create-event-view .form-field input[type="datetime-local"] {
    padding: 0.5rem 0.7rem;
    font-size: 0.95rem;
}

/* Responsive: single column on smaller screens */
@media (max-width: 768px) {
    .guest-event-form-grid {
        grid-template-columns: 1fr;
    }
    
    .guest-event-form-grid .form-field[style*="grid-column"] {
        grid-column: 1 !important;
    }
}

.max-attempts-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.max-attempts-container input {
    flex: 1;
    min-width: 0;
}

.reset-all-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--danger-color);
    background-color: transparent;
    color: var(--danger-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: fit-content;
}

.reset-all-btn:hover:not(:disabled) {
    background-color: #fff5f5;
    border-color: #b91c1c;
    color: #b91c1c;
}

.reset-all-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #9ca3af;
    border-color: #9ca3af;
}

.reset-all-btn:disabled:hover {
    background-color: transparent;
    border-color: #9ca3af;
    color: #9ca3af;
}

.voice-list-link {
    font-weight: 400;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
}

.voice-list-link:hover {
    text-decoration: underline;
}

.timeout-input:focus,
#max-requests-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.2);
}

.timeout-input:hover,
#max-requests-input:hover {
    border-color: #a0a0a0;
}


/* Specific textarea height adjustments */
#case-initial-message-textarea {
    min-height: 60px; /* Smaller height for this specific field */
}

#case-profile-prompt-textarea,
#case-evaluation-prompt-textarea,
#case-facilitator-guide-textarea,
.form-field .background-content {
    min-height: 600px; /* Taller height for markdown/content fields */
}

#case-description-textarea {
    min-height: 300px; /* Reduced height for case description */
}


/* Batch Add Users Modal Styles */
#batch-add-users-modal-backdrop {
    z-index: 1003;
}

#batch-add-users-modal {
    max-width: 600px;
    width: 90%;
}

#batch-emails-textarea {
    min-height: 150px;
    resize: vertical;
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

#batch-default-password,
#batch-default-cohort {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#batch-default-password:focus,
#batch-default-cohort:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.2);
}

/* Add spacing between form fields in batch modal */
#batch-add-users-modal .form-field {
    margin-bottom: 1.25rem;
}

#batch-add-users-modal .form-field:last-child {
    margin-bottom: 0;
}

#batch-creation-progress .spinner {
    width: 20px;
    height: 20px;
    border-width: 3px;
}

#batch-results-container {
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

.batch-result-item {
    padding: 0.25rem 0;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.batch-result-item:last-child {
    border-bottom: none;
}

.batch-result-status {
    font-weight: 600;
    min-width: 70px;
}

.batch-result-status.success {
    color: #28a745;
}

.batch-result-status.warning {
    color: #ffc107;
}

.batch-result-status.error {
    color: var(--danger-color);
}

.batch-result-email {
    flex-grow: 1;
    color: #495057;
}

.batch-result-message {
    font-size: 0.8rem;
    color: #6c757d;
    font-style: italic;
}

#batch-creation-stats {
    display: flex;
    gap: 1rem;
}

.batch-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.batch-stat-success {
    color: #28a745;
    font-weight: 600;
}

.batch-stat-warning {
    color: #ffc107;
    font-weight: 600;
}

.batch-stat-error {
    color: var(--danger-color);
    font-weight: 600;
}

.batch-stat-total {
    color: #6c757d;
    font-weight: 500;
}

/* Asset Download Links in AI Build Modal */
.asset-downloads {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.asset-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #fff;
    border: 1px solid #d1d9e0;
    border-radius: 6px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.asset-link:hover {
    background-color: #f0f8ff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.asset-link svg {
    color: var(--primary-color);
}


.markdown-rendered-content:empty:before {
    content: "No content to display";
    color: #6c757d;
    font-style: italic;
}

/* Background content wrapper specific styles */
.background-content-wrapper {
    margin-top: 8px;
}

.background-content-wrapper .markdown-editor-container {
    margin-top: 4px;
}

/* Ensure markdown editors in forms align with other form elements */
.form-field .markdown-editor-container {
    margin-top: 4px;
}


#review-case-modal {
    max-width: 68vw !important;
    max-height: 76.5vh !important;
}

#user-management-modal {
    max-width: 72vw !important;
    max-height: 82vh !important;
}

#export-discussion-modal,
#export-case-json-modal {
    width: 68vw !important;
    height: 72.25vh !important;
    max-width: 1020px !important;
}
