/* Adapted photo-management/editor styles from the modern dev. */
.photo-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px 110px 48px;
    gap: 4px;
    margin-top: 5px;
    align-items: stretch;
}
.photo-list-name {
    min-width: 0;
    overflow-wrap: anywhere;
    border: 1px solid #c6cdd5;
    border-radius: 4px;
    color: #071833;
    padding: 10px;
    text-align: left;
}
button.photo-list-action,
button.photo-crop-reset {
    margin: 0;
    padding: 8px 10px;
    min-height: 44px;
    border: 0;
    border-radius: 4px;
    background: #4b6896;
    color: white;
    font: 700 14px/1.3 Arial, sans-serif;
    text-shadow: none;
    cursor: pointer;
    box-shadow: none;
}
button.photo-list-action svg { vertical-align: middle; }
button.photo-list-action:hover,
button.photo-crop-reset:hover { background: #354f79; }
button.photo-list-action:focus-visible,
button.photo-crop-reset:focus-visible,
.photo-crop-canvas:focus-visible { outline: 3px solid #1c7583; outline-offset: 3px; }
.photo-crop-dialog { padding: 16px !important; max-width: calc(100vw - 20px) !important; }
.photo-crop-dialog .swal2-html-container { margin: 12px 0 0; overflow: visible; }
.photo-crop-stage {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #182435;
    border-radius: 6px;
    overflow: hidden;
    padding: 2px;
}
.photo-crop-canvas { display: block; touch-action: none; cursor: move; max-width: 100%; }
.photo-crop-help { margin: 8px 0 12px; text-align: left; font: 14px/1.5 Arial, sans-serif; color: #354055; }
.photo-crop-message { margin: 8px 0; color: #942604; font: 14px/1.5 Arial, sans-serif; }
.photo-crop-dialog .swal2-actions { flex-wrap: wrap; gap: 8px; }
.photo-crop-dialog .swal2-confirm,
.photo-crop-dialog .swal2-cancel { min-height: 44px; margin: 0; }
@media (max-width: 600px) {
    .photo-list-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 48px; }
    .photo-list-name { grid-column: 1 / -1; }
    .photo-list-action { width: 100%; }
    .photo-crop-dialog .swal2-title { font-size: 22px; padding: 4px; }
    .photo-crop-dialog .swal2-confirm,
    .photo-crop-dialog .swal2-cancel { flex: 1; }
}

/* The crop dialog has no checkbox input. Legacy dialog CSS must not reveal it. */
.photo-crop-dialog .swal2-checkbox,
.photo-save-confirmation .swal2-checkbox { display: none !important; }

.photo-edit-tools { margin: 10px 0; }
button.photo-rotate,
button.photo-adjustments-reset {
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid #4b6896;
    border-radius: 4px;
    background: white;
    color: #354f79;
    font: 700 14px/1.4 Arial, sans-serif;
    text-shadow: none;
    box-shadow: none;
    cursor: pointer;
}
.photo-adjustments { margin-top: 12px; text-align: left; border-top: 1px solid #d6dce5; }
.photo-adjustments summary {
    padding: 12px 4px;
    min-height: 44px;
    box-sizing: border-box;
    cursor: pointer;
    color: #354f79;
    font: 700 16px/1.4 Arial, sans-serif;
}
.photo-adjustment { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; margin: 4px 0 10px; }
.photo-adjustment label,
.photo-adjustment output { margin: 0; color: #354055; font: 14px/1.5 Arial, sans-serif; }
.photo-adjustment output { font-variant-numeric: tabular-nums; }
.photo-adjustment input[type="range"] {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    accent-color: #227482;
    cursor: pointer;
}
.photo-adjustments summary:focus-visible,
.photo-adjustment input:focus-visible,
button.photo-rotate:focus-visible,
button.photo-adjustments-reset:focus-visible { outline: 3px solid #1c7583; outline-offset: 2px; }
@media (max-width: 600px) {
    .photo-crop-dialog { max-height: calc(100dvh - 20px); overflow-y: auto; }
    .photo-crop-dialog .swal2-actions { position: sticky; bottom: -16px; background: white; padding: 12px 0; z-index: 2; }
}
.photo-file-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; }
.photo-file-picker .photo-file-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    box-sizing: border-box;
    padding: 10px 16px;
    margin: 0;
    border: 1px solid #227482;
    border-radius: 8px;
    background: white;
    color: #175b66;
    font: 700 14px/1.4 Arial, sans-serif;
    text-shadow: none;
    overflow: hidden;
    cursor: pointer;
}
.photo-file-button svg { fill: none; stroke: currentColor; stroke-width: 1.6; flex: 0 0 auto; }
.photo-file-button input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
}
.photo-file-picker .photo-file-button:hover { background: #edf5f6; }
.photo-file-picker .photo-file-button:focus-within { outline: 3px solid #227482; outline-offset: 3px; }
.photo-selected-name { min-width: 0; overflow-wrap: anywhere; color: #354055; font: 14px/1.5 Arial, sans-serif; text-shadow: none; }
@media (max-width: 600px) {
    .photo-file-picker { align-items: flex-start; flex-direction: column; gap: 8px; }
    .photo-selected-name { width: 100%; }
}

.photo-upload-preview { display: block; width: auto; height: auto; max-width: 180px; max-height: 120px; margin-top: 12px; border-radius: 8px; object-fit: contain; }
.photo-upload-preview[hidden] { display: none !important; }

.photo-list-name { display: flex; align-items: center; gap: 12px; }
.photo-list-name > span { min-width: 0; overflow-wrap: anywhere; }
.photo-list-thumbnail { width: 80px; height: 56px; flex: 0 0 80px; object-fit: cover; border-radius: 5px; background: #edf1f5; }
.photo-list-thumbnail[hidden] { display: none !important; }
button.photo-preview-toggle { display: inline-block; min-height: 44px; margin: 10px 0 8px; padding: 8px 14px; border: 1px solid #227482; border-radius: 8px; background: white; color: #175b66; font: 700 14px/1.4 Arial, sans-serif; text-shadow: none; box-shadow: none; cursor: pointer; }
button.photo-preview-toggle:hover { background: #edf5f6; }
button.photo-preview-toggle:focus-visible { outline: 3px solid #227482; outline-offset: 3px; }

/* Keep each image and its actions visibly together on mobile. */
@media (max-width: 600px) {
    #cards_container_pics .photo-list-row {
        width: 100%;
        box-sizing: border-box;
        margin: 0 0 14px;
        padding: 10px;
        gap: 8px 6px;
        border: 1px solid #c3ccd8;
        border-radius: 10px;
        background: #fff;
    }
    #cards_container_pics .photo-list-name {
        border: 0;
        border-radius: 0;
        padding: 0 0 4px;
        font-weight: 600;
    }
}

.photo-list-row { grid-template-columns: minmax(0, 1fr) 120px 100px 100px 48px; }
.photo-usage-dialog { max-width: calc(100vw - 20px) !important; }
.photo-usage-dialog .swal2-checkbox { display: none !important; }
.photo-usage-filename { color: #354055; overflow-wrap: anywhere; font: 14px/1.5 Arial, sans-serif; }
.photo-usage-results { color: #071833; font: 14px/1.5 Arial, sans-serif; text-align: left; }
.photo-usage-list { list-style: none; padding: 0; margin: 0; max-height: 55vh; overflow-y: auto; }
.photo-usage-list li { padding: 12px 0; border-bottom: 1px solid #d6dce5; overflow-wrap: anywhere; }
.photo-usage-list li:last-child { border-bottom: 0; }
.photo-usage-list strong { display: block; font-size: 16px; }
.photo-usage-list span { display: block; margin-top: 3px; color: #354055; font-size: 13px; }
@media (max-width: 600px) {
    .photo-list-row { grid-template-columns: repeat(3, minmax(0, 1fr)) 48px; }
    button.photo-list-action { min-width: 0; padding: 8px 4px; font-size: 13px; }
}

.photo-detail-image-tools { display: flex; justify-content: flex-start; margin: 8px 0 12px; }
button.photo-detail-edit { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; margin: 0; border: 1px solid #227482; border-radius: 8px; background: white; color: #175b66; font: 700 14px/1.4 Arial, sans-serif; text-shadow: none; box-shadow: none; cursor: pointer; }
button.photo-detail-edit:hover { background: #edf5f6; }
button.photo-detail-edit:focus-visible { outline: 3px solid #227482; outline-offset: 3px; }
.photo-detail-edit svg { flex: 0 0 auto; }

