/* ==========================================================================
   Ditio File Modal — uploader, gallery, lightbox, location picker
   Design layer for FileViewUploadModal / EnhancedFileUploader /
   ImagesScaleToScreen. Built on the Ditio modern tokens (css.vars.css).
   Scoped: .ditio-file-modal-dialog, .enhanced-file-uploader,
           .ditio-file-gallery, .ditio-lightbox, #locationPickerModal
   ========================================================================== */

:root {
    --dfm-ink: #1b1b18;
    --dfm-ink-soft: #706f6c;
    --dfm-ink-faint: #90908c;
    --dfm-paper: #ffffff;
    --dfm-sand: #f9f9f8;
    --dfm-sand-deep: #f3f3f2;
    --dfm-line: #e3e3e0;
    --dfm-line-strong: #c8c7c1;
    --dfm-blue: #017eff;
    --dfm-blue-soft: rgba(1, 126, 255, 0.07);
    --dfm-blue-line: rgba(1, 126, 255, 0.35);
    --dfm-red: #ea555a;
    --dfm-red-soft: rgba(234, 85, 90, 0.08);
    --dfm-green: #46a758;
    --dfm-green-soft: rgba(70, 167, 88, 0.1);
    --dfm-amber: #b97502;
    --dfm-amber-soft: #fdf3e2;
    --dfm-amber-line: #f0d9a8;
    --dfm-radius: 12px;
    --dfm-radius-sm: 8px;
    --dfm-shadow-card: 0 1px 2px rgba(27, 27, 24, 0.06), 0 0 0 1px rgba(27, 27, 24, 0.04);
    --dfm-shadow-pop: 0 12px 32px rgba(27, 27, 24, 0.16);
    --dfm-font: 'Aeonik', 'Helvetica Neue', Arial, sans-serif;
}

/* ==========================================================================
   Modal shell
   ========================================================================== */

.ditio-file-modal-dialog {
    width: 940px;
    max-width: calc(100vw - 32px);
}

@media (max-width: 991px) {
    .ditio-file-modal-dialog {
        width: auto;
        margin: 16px;
    }
}

.ditio-file-modal-dialog .modal-content {
    border: none;
    border-radius: var(--dfm-radius);
    box-shadow: var(--dfm-shadow-pop);
    font-family: var(--dfm-font);
    color: var(--dfm-ink);
    overflow: hidden;
}

.ditio-file-modal-dialog .modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--dfm-line);
    background: var(--dfm-paper);
}

.ditio-file-modal-dialog .modal-header .modal-title {
    font-family: var(--dfm-font);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--dfm-ink);
}

.ditio-file-modal-dialog .modal-header .close {
    margin-top: -2px;
    font-size: 26px;
    color: var(--dfm-ink-faint);
    opacity: 1;
    transition: color 0.15s ease;
}

.ditio-file-modal-dialog .modal-header .close:hover {
    color: var(--dfm-ink);
}

.ditio-file-modal-dialog .modal-body {
    padding: 20px 24px 24px;
    background: var(--dfm-sand);
}

.ditio-file-modal-dialog .modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--dfm-line);
    background: var(--dfm-paper);
}

.ditio-file-modal-dialog .modal-footer .btn-primary {
    background: var(--dfm-blue);
    border: none;
    border-radius: var(--dfm-radius-sm);
    font-family: var(--dfm-font);
    font-weight: 500;
    padding: 8px 22px;
    transition: filter 0.15s ease;
}

.ditio-file-modal-dialog .modal-footer .btn-primary:hover {
    filter: brightness(0.92);
}

/* ==========================================================================
   Enhanced uploader
   ========================================================================== */

.enhanced-file-uploader {
    font-family: var(--dfm-font);
    color: var(--dfm-ink);
    margin-bottom: 20px;
}

/* neutralize the legacy bootstrap panel wrapper */
.enhanced-file-uploader .panel.panel-primary {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    margin: 0;
}

.enhanced-file-uploader .panel-heading {
    background: transparent;
    border: none;
    padding: 0 0 10px;
}

.enhanced-file-uploader .panel-title {
    color: var(--dfm-ink-soft);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.enhanced-file-uploader .panel-body {
    padding: 0;
}

/* --- Dropzones ------------------------------------------------------- */

.upload-zones {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

.upload-zones .enhanced-dropzone {
    flex: 1 1 0;
    margin-bottom: 0;
}

.enhanced-dropzone.dropzone {
    /* fight dropzone.min.css defaults */
    min-height: 0;
    border: 1.5px dashed var(--dfm-line-strong);
    border-radius: var(--dfm-radius);
    background: var(--dfm-paper);
    padding: 0;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.enhanced-dropzone.dropzone:hover {
    border-color: var(--dfm-blue-line);
    background: var(--dfm-blue-soft);
}

.enhanced-dropzone.dropzone.dz-drag-hover {
    border-color: var(--dfm-blue);
    border-style: solid;
    background: var(--dfm-blue-soft);
    transform: scale(1.01);
}

.enhanced-dropzone .dz-message {
    margin: 0;
    padding: 18px 14px;
}

.enhanced-dropzone .dropzone-title {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dfm-ink);
}

.enhanced-dropzone .dropzone-title .fa {
    margin-right: 6px;
}

.enhanced-dropzone .dropzone-hint {
    margin: 0;
    font-size: 12.5px;
    color: var(--dfm-ink-faint);
}

/* hide dropzone.js auto-generated previews; the queue renders its own cards */
.enhanced-dropzone .dz-preview {
    display: none;
}

/* --- Batch location bar ---------------------------------------------- */

.batch-actions {
    margin-top: 12px;
}

.batch-actions .batch-alert.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0;
    padding: 10px 14px;
    background: var(--dfm-amber-soft);
    border: 1px solid var(--dfm-amber-line);
    border-radius: var(--dfm-radius-sm);
    color: var(--dfm-amber);
    font-size: 13px;
    font-weight: 500;
}

.batch-actions .batch-buttons {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.batch-actions .btn {
    border-radius: 6px;
    font-family: var(--dfm-font);
    font-size: 12.5px;
    padding: 4px 12px;
}

.batch-actions .btn-primary {
    background: var(--dfm-blue);
    border-color: var(--dfm-blue);
}

/* --- Queue file cards -------------------------------------------------- */

.file-cards {
    margin-top: 12px;
}

.file-cards .file-card.panel {
    margin: 0 0 8px;
    border: none;
    border-radius: var(--dfm-radius);
    background: var(--dfm-paper);
    box-shadow: var(--dfm-shadow-card);
    animation: dfm-rise 0.25s ease both;
}

.file-cards .file-card .panel-body {
    padding: 12px 14px;
}

/* the template uses .row/.col-* — flatten them inside the card */
.file-cards .file-card .row {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
}

.file-cards .file-card .row > [class*="col-"] {
    padding: 0;
    float: none;
}

.file-cards .file-card .file-preview-col {
    flex: 0 0 56px;
    width: 56px !important;
    margin-right: 14px;
}

.file-cards .file-card .file-info-col {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
}

.file-cards .file-card .file-actions-col {
    flex: 0 0 auto;
    width: auto !important;
    margin-left: 12px;
}

.file-preview-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--dfm-radius-sm);
    display: block;
    background: var(--dfm-sand-deep);
}

.file-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: var(--dfm-radius-sm);
    background: var(--dfm-sand-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dfm-ink-faint);
}

.file-icon-wrapper .fa {
    font-size: 22px;
}

.file-icon-wrapper.small {
    width: 40px;
    height: 40px;
}

.file-icon-wrapper.small .fa {
    font-size: 16px;
}

.file-card .file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dfm-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card .file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 12px;
    color: var(--dfm-ink-faint);
}

.file-card .access-badge {
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 9px;
    letter-spacing: 0.02em;
}

.file-card .access-badge.label-danger {
    background: var(--dfm-red-soft);
    color: var(--dfm-red);
}

.file-card .access-badge.label-info {
    background: var(--dfm-blue-soft);
    color: var(--dfm-blue);
}

/* --- Location status rows --------------------------------------------- */

.location-status {
    margin-top: 8px;
    font-size: 12.5px;
}

.location-status .location-actions,
.location-status .location-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.location-status .text-warning {
    color: var(--dfm-amber);
    font-weight: 500;
}

.location-status .btn {
    border-radius: 6px;
    font-family: var(--dfm-font);
    font-size: 12px;
    padding: 3px 11px;
}

.location-status .btn-primary {
    background: var(--dfm-blue);
    border-color: var(--dfm-blue);
}

.location-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--dfm-green-soft);
    color: var(--dfm-green);
    border-radius: 999px;
    padding: 3px 11px;
    font-size: 12px;
    font-weight: 600;
    max-width: 100%;
}

.location-chip .location-coords-text {
    font-weight: 400;
    color: var(--dfm-ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-chip-edit {
    border: none;
    background: none;
    padding: 0 0 0 2px;
    color: var(--dfm-blue);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.location-chip-edit:hover {
    text-decoration: underline;
}

/* --- Progress / error -------------------------------------------------- */

.upload-progress {
    margin-top: 8px;
}

.upload-progress .progress {
    height: 6px;
    margin: 0;
    border-radius: 999px;
    background: var(--dfm-sand-deep);
    box-shadow: none;
}

.upload-progress .progress-bar {
    background: var(--dfm-blue);
    border-radius: 999px;
    box-shadow: none;
}

.upload-progress .progress-bar span {
    display: none;
}

.upload-error {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
}

.upload-error .text-danger {
    color: var(--dfm-red);
}

.upload-error .btn-warning {
    border-radius: 6px;
    font-size: 12px;
    padding: 3px 11px;
}

/* --- Card action buttons ----------------------------------------------- */

.file-actions-col .btn,
.completed-file-card .btn {
    border: none;
    background: transparent;
    color: var(--dfm-ink-faint);
    border-radius: var(--dfm-radius-sm);
    width: 32px;
    height: 32px;
    padding: 0;
    line-height: 32px;
    text-align: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.file-actions-col .btn:hover,
.completed-file-card .btn:hover {
    background: var(--dfm-sand-deep);
    color: var(--dfm-ink);
}

.file-actions-col .btn-danger,
.completed-file-card .btn-danger {
    color: var(--dfm-ink-faint);
}

.file-actions-col .btn-danger:hover,
.completed-file-card .btn-danger:hover {
    background: var(--dfm-red-soft);
    color: var(--dfm-red);
}

/* --- Completed section -------------------------------------------------- */

.completed-files-section {
    margin-top: 16px;
}

.completed-files-section .completed-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--dfm-ink-soft);
    margin: 0 0 8px;
}

.completed-files-section .completed-header .fa-check-circle {
    color: var(--dfm-green);
    margin-right: 4px;
}

.completed-file-card {
    background: var(--dfm-paper);
    border-radius: var(--dfm-radius-sm);
    box-shadow: var(--dfm-shadow-card);
    padding: 8px 12px;
    margin-bottom: 6px;
    animation: dfm-rise 0.25s ease both;
}

.completed-file-card .row {
    display: flex;
    align-items: center;
    margin: 0;
}

.completed-file-card .row > [class*="col-"] {
    padding: 0;
    float: none;
}

.completed-file-card .row > .col-xs-2 {
    flex: 0 0 40px;
    width: 40px !important;
    margin-right: 12px;
}

.completed-file-card .row > .col-xs-6 {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
}

.completed-file-card .row > .col-xs-4 {
    flex: 0 0 auto;
    width: auto !important;
    margin-left: 12px;
}

.completed-file-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.completed-file-card .file-name.small {
    font-size: 13px;
    font-weight: 500;
}

/* --- Uploader footer ----------------------------------------------------- */

.uploader-footer {
    margin-top: 12px;
}

.uploader-footer .upload-status {
    font-size: 13px;
    margin-bottom: 8px;
}

.uploader-footer .footer-buttons .btn-success {
    background: var(--dfm-green);
    border: none;
    border-radius: var(--dfm-radius-sm);
    font-family: var(--dfm-font);
    font-weight: 500;
    font-size: 14px;
    padding: 8px 26px;
}

/* ==========================================================================
   Gallery (.ditio-file-gallery) — shared image/file viewer
   ========================================================================== */

.ditio-file-gallery {
    font-family: var(--dfm-font);
    color: var(--dfm-ink);
}

.ditio-file-gallery .gallery-section-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dfm-ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 4px 0 10px;
}

.ditio-file-gallery .gallery-count {
    font-weight: 400;
    color: var(--dfm-ink-faint);
    text-transform: none;
    letter-spacing: 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.gallery-card {
    border-radius: var(--dfm-radius);
    background: var(--dfm-paper);
    box-shadow: var(--dfm-shadow-card);
    overflow: hidden;
    animation: dfm-rise 0.3s ease both;
}

.gallery-card:nth-child(2) { animation-delay: 0.04s; }
.gallery-card:nth-child(3) { animation-delay: 0.08s; }
.gallery-card:nth-child(4) { animation-delay: 0.12s; }
.gallery-card:nth-child(5) { animation-delay: 0.16s; }
.gallery-card:nth-child(6) { animation-delay: 0.2s; }
.gallery-card:nth-child(n+7) { animation-delay: 0.24s; }

.gallery-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--dfm-sand-deep);
    overflow: hidden;
    cursor: zoom-in;
    border: none;
    padding: 0;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.gallery-card:hover .gallery-thumb img {
    transform: scale(1.045);
}

/* hover action overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 6px;
    padding: 10px;
    background: linear-gradient(180deg, rgba(27, 27, 24, 0) 55%, rgba(27, 27, 24, 0.45) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-card:hover .gallery-overlay,
.gallery-card:focus-within .gallery-overlay {
    opacity: 1;
}

.gallery-action {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--dfm-radius-sm);
    background: rgba(255, 255, 255, 0.94);
    color: var(--dfm-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(27, 27, 24, 0.22);
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    text-decoration: none;
}

.gallery-action:hover,
.gallery-action:focus {
    background: #ffffff;
    color: var(--dfm-blue);
    transform: translateY(-1px);
    text-decoration: none;
}

.gallery-action.gallery-action-danger:hover {
    color: var(--dfm-red);
}

/* geo badge pinned top-left over photo */
.gallery-geo-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(27, 27, 24, 0.62);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    border-radius: 999px;
    padding: 3px 9px;
    pointer-events: none;
}

/* card meta row */
.gallery-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px 10px;
    font-size: 12px;
    color: var(--dfm-ink-soft);
    min-height: 38px;
}

.gallery-meta .gallery-date {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-meta .gallery-type-chip {
    margin-left: auto;
    background: var(--dfm-sand-deep);
    color: var(--dfm-ink-soft);
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 0 0 auto;
}

.gallery-meta .gallery-security {
    flex: 0 0 auto;
}

.gallery-meta .gallery-security .fa-user-secret {
    color: var(--dfm-red);
}

.gallery-meta .gallery-security .fa-globe {
    color: var(--dfm-blue);
}

/* non-image document card */
.gallery-doc {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    text-decoration: none;
    color: var(--dfm-ink);
}

.gallery-doc:hover {
    text-decoration: none;
    color: var(--dfm-blue);
}

.gallery-doc .gallery-doc-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--dfm-radius-sm);
    background: var(--dfm-sand-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dfm-ink-faint);
    font-size: 18px;
    flex: 0 0 auto;
}

.gallery-doc .gallery-doc-name {
    font-size: 13px;
    font-weight: 500;
    word-break: break-word;
}

/* empty state */
.gallery-empty {
    text-align: center;
    color: var(--dfm-ink-faint);
    padding: 28px 12px;
    font-size: 13.5px;
}

.gallery-empty .fa {
    display: block;
    font-size: 26px;
    margin-bottom: 8px;
    color: var(--dfm-line-strong);
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.ditio-lightbox {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5000;
    background: rgba(20, 20, 18, 0.93);
    display: flex;
    flex-direction: column;
    font-family: var(--dfm-font);
    animation: dfm-fade 0.18s ease both;
}

.ditio-lightbox .lightbox-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    color: #fff;
}

.ditio-lightbox .lightbox-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ditio-lightbox .lightbox-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
}

.ditio-lightbox .lightbox-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.ditio-lightbox .lightbox-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--dfm-radius-sm);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
}

.ditio-lightbox .lightbox-btn:hover,
.ditio-lightbox .lightbox-btn:focus {
    background: rgba(255, 255, 255, 0.26);
    color: #fff;
    text-decoration: none;
}

.ditio-lightbox .lightbox-stage {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0 64px 28px;
    position: relative;
}

.ditio-lightbox .lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
    animation: dfm-rise 0.22s ease both;
}

.ditio-lightbox .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ditio-lightbox .lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.28);
}

.ditio-lightbox .lightbox-nav.lightbox-prev { left: 14px; }
.ditio-lightbox .lightbox-nav.lightbox-next { right: 14px; }

.ditio-lightbox .lightbox-counter {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
}

/* ==========================================================================
   Location picker modal
   ========================================================================== */

#locationPickerModal .modal-dialog {
    width: 720px;
    max-width: calc(100vw - 32px);
}

#locationPickerModal .modal-content {
    border: none;
    border-radius: var(--dfm-radius);
    box-shadow: var(--dfm-shadow-pop);
    font-family: var(--dfm-font);
    overflow: hidden;
}

#locationPickerModal .modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--dfm-line);
}

#locationPickerModal .modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--dfm-ink);
}

#locationPickerModal .modal-body {
    padding: 16px 22px;
}

#locationPickerModal .picker-hint {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--dfm-ink-faint);
}

#locationPickerModal #locationPickerMap {
    border-radius: var(--dfm-radius-sm);
    border: 1px solid var(--dfm-line);
}

#locationPickerModal .location-coordinates {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#locationPickerModal .coords-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--dfm-sand-deep);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12.5px;
    color: var(--dfm-ink-soft);
}

#locationPickerModal .coords-chip .fa {
    color: var(--dfm-blue);
}

#locationPickerModal .modal-footer {
    padding: 12px 22px;
    border-top: 1px solid var(--dfm-line);
}

#locationPickerModal .btn {
    border-radius: var(--dfm-radius-sm);
    font-family: var(--dfm-font);
    font-size: 13.5px;
    padding: 7px 18px;
}

#locationPickerModal .btn-default {
    border: 1px solid var(--dfm-line-strong);
    background: var(--dfm-paper);
    color: var(--dfm-ink-soft);
}

#locationPickerModal .btn-default:hover {
    background: var(--dfm-sand-deep);
}

#locationPickerModal .btn-primary {
    background: var(--dfm-blue);
    border: none;
}

#locationPickerModal .btn-primary[disabled] {
    background: var(--dfm-line-strong);
}

#locationPickerModal .btn-link.use-my-location {
    color: var(--dfm-blue);
    font-size: 12.5px;
    padding: 0;
    margin-left: auto;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes dfm-rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dfm-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card,
    .file-cards .file-card.panel,
    .completed-file-card,
    .ditio-lightbox,
    .ditio-lightbox .lightbox-stage img {
        animation: none;
    }

    .gallery-card:hover .gallery-thumb img {
        transform: none;
    }
}

/* ==========================================================================
   Image-modal management: multi-select, access toggle, drag handle, action
   bar and the copy/move transaction picker.
   ========================================================================== */

.ditio-file-gallery .gallery-card {
    position: relative;
}

.ditio-file-gallery .gallery-card.is-selected {
    box-shadow: 0 0 0 2px var(--dfm-blue), var(--dfm-shadow-card);
}

/* Per-image select checkbox (top-left). */
.ditio-file-gallery .gallery-select {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 6;
    margin: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--dfm-radius-sm);
    box-shadow: var(--dfm-shadow-card);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.ditio-file-gallery .gallery-card:hover .gallery-select,
.ditio-file-gallery .gallery-card.is-selected .gallery-select {
    opacity: 1;
}

.ditio-file-gallery .gallery-select input {
    margin: 0;
    cursor: pointer;
}

/* Drag handle (top-right of the thumb). The whole thumb is draggable; this is
   the visible affordance for the full-quality drag. */
.ditio-file-gallery .gallery-drag-handle {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 6;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    color: var(--dfm-ink-soft);
    border-radius: var(--dfm-radius-sm);
    box-shadow: var(--dfm-shadow-card);
    cursor: grab;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.ditio-file-gallery .gallery-card:hover .gallery-drag-handle {
    opacity: 1;
}

.ditio-file-gallery .gallery-thumb:active .gallery-drag-handle {
    cursor: grabbing;
}

/* Clickable access-level toggle. */
.ditio-file-gallery .gallery-security-toggle {
    border: none;
    background: transparent;
    padding: 0 2px;
    cursor: pointer;
    color: inherit;
    line-height: 1;
}

.ditio-file-gallery .gallery-security-toggle:hover {
    color: var(--dfm-blue);
}

/* Selection action bar. */
.ditio-file-gallery .gallery-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--dfm-blue-soft);
    border: 1px solid var(--dfm-blue-line);
    border-radius: var(--dfm-radius-sm);
}

.ditio-file-gallery .gallery-action-bar__count {
    font-weight: 600;
    color: var(--dfm-ink);
}

.ditio-file-gallery .gallery-action-bar__buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Copy/Move transaction picker. */
.ditio-file-gallery .gallery-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 3200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(27, 27, 24, 0.45);
    padding: 16px;
}

.ditio-file-gallery .gallery-picker {
    width: 420px;
    max-width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--dfm-paper);
    border-radius: var(--dfm-radius);
    box-shadow: var(--dfm-shadow-pop);
    overflow: hidden;
}

.ditio-file-gallery .gallery-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--dfm-line);
    font-weight: 600;
    color: var(--dfm-ink);
}

.ditio-file-gallery .gallery-picker__close {
    border: none;
    background: transparent;
    color: var(--dfm-ink-faint);
    cursor: pointer;
    font-size: 15px;
}

.ditio-file-gallery .gallery-picker__loading {
    padding: 24px 16px;
    text-align: center;
    color: var(--dfm-ink-soft);
}

.ditio-file-gallery .gallery-picker__list {
    list-style: none;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
}

.ditio-file-gallery .gallery-picker__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: var(--dfm-radius-sm);
    color: var(--dfm-ink);
    cursor: pointer;
}

.ditio-file-gallery .gallery-picker__item:hover:not(:disabled) {
    background: var(--dfm-sand-deep);
}

.ditio-file-gallery .gallery-picker__item:disabled {
    cursor: default;
    color: var(--dfm-ink-faint);
}

.ditio-file-gallery .gallery-picker__list li.is-current {
    opacity: 0.75;
}

.ditio-file-gallery .gallery-picker__current {
    font-size: 11px;
    color: var(--dfm-blue);
    white-space: nowrap;
}
