/* Table Styles */
.app-content {
    max-width: 1700px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 1200px) {
    .app-content {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

.table-sm > :not(caption) > * > * {
    padding: 0.15rem 0.5rem;
}

.table.geographic-list {
    margin-bottom: 0;
}

.table.geographic-list td,
.table.geographic-list th {
    padding: 0.1rem 0.2rem !important;
    vertical-align: middle !important;
    font-size: 0.9rem !important;
    line-height: 1.0 !important;
}

.table > tbody > tr:hover,
.table.geographic-list tbody tr:hover {
    background-color: rgba(0,0,0,.075);
}

/* Count Badge */
.count-badge {
    display: inline-block;
    min-width: 30px;
    padding: 0.15rem 0.4rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    border-radius: 0.25rem;
    color: #fff;
    background-color: #0d6efd;
    text-decoration: none;
}

.count-badge:hover {
    background-color: #0b5ed7;
    color: #fff;
}

/* Action Icons - Consistent styling across juvenile interface */
.action-icon {
    background: none;
    border: none;
    padding: 8px;
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    min-width: 32px;
}

.action-icon:hover {
    background-color: rgba(13, 110, 253, 0.1);
    text-decoration: none;
}

.action-icon .fas {
    width: 16px;
    text-align: center;
}

/* More Actions Dropdown Toggle */
.more-actions {
    background: none;
    border: none;
    padding: 8px;
    color: #6c757d;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    min-width: 32px;
}

.more-actions:hover {
    background-color: rgba(108, 117, 125, 0.1);
}

/* Standard colors for action icons */
.text-primary { color: #0d6efd !important; }
.text-warning { color: #ffc107 !important; }
.text-info { color: #0dcaf0 !important; }
.text-secondary { color: #6c757d !important; }

/* HTMX Loading States */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator {
    opacity: 1
}
.htmx-request.htmx-indicator {
    opacity: 1
}

/* Compact Form Styling */
.form-control, .form-select {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
}

.form-label {
    margin-bottom: 0.25rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
}

/* Reduce margins between form rows */
.row {
    margin-bottom: 0.75rem !important;
}

.mb-3 {
    margin-bottom: 0.75rem !important;
}

/* Card body padding reduction */
.card-body {
    padding: 1rem !important;
}

/* Checkbox and boolean field styling */
.form-check {
    margin-bottom: 0.25rem !important;
    padding-left: 1.25rem !important;
}

.form-check-input {
    margin-top: 0.125rem !important;
}

.form-check-label {
    font-size: 0.875rem !important;
    margin-bottom: 0 !important;
}

/* Button spacing */
.btn {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.875rem !important;
}

/* Crispy forms specific adjustments */
.crispy-field {
    margin-bottom: 0.75rem !important;
}

/* Remove excessive spacing from Bootstrap's form groups */
.mb-3, .form-group {
    margin-bottom: 0.75rem !important;
}

/* Reduce spacing between card sections */
.card.mb-4 {
    margin-bottom: 1rem !important;
}

/* Reduce card header padding */
.card-header {
    padding: 0.75rem 1rem !important;
}

/* Reduce spacing in form containers */
.container-fluid .mt-4 {
    margin-top: 1rem !important;
}

.mb-5 {
    margin-bottom: 1.5rem !important;
}

/* Global form layout overrides: consistent compact spacing for all app forms */
form .card.mb-4 {
    margin-bottom: 0.75rem !important;
}

form .form-actions.mt-4 {
    margin-top: 1rem !important;
}

form .form-actions.mb-5 {
    margin-bottom: 1.5rem !important;
}

form .card-body {
    padding: 0.75rem !important;
}

/* Compact rows inside forms */
form .row {
    margin-bottom: 0.5rem !important;
}

form .row:last-child {
    margin-bottom: 0 !important;
}

/* Reduce crispy form field spacing in all forms */
form .mb-3,
form .form-group {
    margin-bottom: 0.5rem !important;
}

/* Standard form rule: hide field help text on edit/create screens */
form .helptext,
form .form-text {
    display: none !important;
}

/* Sticky form actions */
form:has(.form-actions-sticky) {
    padding-bottom: 6.5rem;
}

.form-actions-sticky {
    position: sticky;
    bottom: 0.75rem;
    z-index: 1020;
    margin-top: 1rem;
}

.form-actions-sticky__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 0.9rem 1rem;
    border: 1px solid #d6dbe1;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 0.5rem 1rem rgba(33, 37, 41, 0.12);
    backdrop-filter: blur(6px);
}

@supports not selector(form:has(.form-actions-sticky)) {
    .form-actions-sticky {
        margin-bottom: 5.5rem;
    }
}

@media (max-width: 767.98px) {
    .form-actions-sticky {
        bottom: 0.5rem;
    }

    .form-actions-sticky__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions-sticky__inner .btn {
        width: 100%;
    }
}

/* Detention booking checklist */
.booking-checklist-form .card-header {
    font-size: 0.92rem;
}

.checklist-grid-header,
.checklist-grid-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.3fr) minmax(110px, 0.8fr) minmax(180px, 1.4fr) minmax(140px, 1fr) minmax(120px, 0.9fr) minmax(180px, 1.6fr);
    gap: 0.5rem;
    align-items: center;
}

.checklist-grid-header {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0.5rem;
}

.checklist-grid-row {
    padding: 0.32rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.checklist-grid-row:last-of-type {
    border-bottom: 0;
}

.checklist-cell .form-group,
.checklist-cell .mb-3 {
    margin-bottom: 0;
}

.checklist-label {
    font-size: 0.92rem;
    font-weight: 500;
}

.checklist-grid-errors {
    margin-bottom: 0.5rem;
}

.checklist-status-panel {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #f8f9fa;
}

.checklist-status-panel.is-complete {
    border-color: #198754;
    background: #eef9f2;
}

.checklist-status-heading {
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #6c757d;
    border-bottom: 1px solid #dee2e6;
}

.checklist-status-body {
    padding: 0.75rem;
}

@media (max-width: 991.98px) {
    .checklist-grid-header {
        display: none;
    }

    .checklist-grid-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
        padding: 0.75rem 0;
    }

    .checklist-label {
        margin-bottom: 0.15rem;
    }
}

/* ── Detention Pod Report ───────────────────────────────────── */
.pod-report-table-wrap {
    overflow-x: auto;
}

table.table.pod-report-table {
    font-size: 0.78rem !important;
    white-space: nowrap;
}

.pod-report-header {
    vertical-align: bottom;
    white-space: normal;
    line-height: 1.1;
    min-width: 3.5rem;
    max-width: 6rem;
}

table.table.pod-report-table td,
table.table.pod-report-table th {
    padding: 0.25rem 0.35rem;
}

.pod-report-sticky-name_combined,
.pod-report-sticky-room_display,
.pod-report-sticky-pod {
    position: sticky;
    background: var(--bs-body-bg, #fff);
    z-index: 2;
}

.pod-report-sticky-name_combined {
    left: 0;
    min-width: 9rem;
    max-width: 11rem;
}

.pod-report-sticky-room_display {
    left: 9rem;
    min-width: 4.5rem;
}

.pod-report-sticky-pod {
    left: 13.5rem;
    min-width: 3.5rem;
}

.pod-report-empty-row {
    color: var(--bs-secondary-color);
}

.pod-report-inactive-room td {
    background-color: rgba(108, 117, 125, 0.08);
}

.pod-report-cell-commentable {
    cursor: pointer;
}

.pod-report-cell-commented {
    background-color: #fff3cd !important;
    box-shadow: inset 0 0 0 2px rgba(255, 193, 7, 0.75);
}

.pod-report-name-cell {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pod-report-history-table {
    background: rgba(0, 0, 0, 0.02);
}

.pod-report-history-instance {
    opacity: 0.85;
}

.pod-report-selectable-row {
    cursor: pointer;
}

.pod-report-selectable-row:focus {
    outline: 2px solid rgba(13, 110, 253, 0.35);
    outline-offset: -2px;
}

.pod-report-row-selected > td {
    background-color: rgba(13, 110, 253, 0.08) !important;
}

.pod-report-row-selected > td.pod-report-cell-commented {
    background-color: #fff3cd !important;
}

.pod-report-bottom-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
}

.pod-report-action-btn.disabled {
    pointer-events: none;
    opacity: 0.55;
}
