/* ============================================================================
   App dialogs (SweetAlert2): confirmations and notices across the app.
   Classes are set in wwwroot/js/site-scripts.js (appDialogClasses).
   ============================================================================ */

.swal2-popup.app-dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 28px 28px 24px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
    font-family: inherit;
}

/* Smaller, calmer icon than SweetAlert's default: the whole icon is scaled, so the drawn
   success/error marks stay intact; the negative margins take back the space it no longer uses */
.swal2-popup.app-dialog .swal2-icon.app-dialog-icon {
    margin: -8px auto -4px;
    transform: scale(0.7);
}

.swal2-popup.app-dialog .app-dialog-title {
    margin: 0;
    padding: 0;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
    color: #1e293b;
    letter-spacing: 0.01em;
}

.swal2-popup.app-dialog .app-dialog-text {
    margin: 10px 0 0;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #475569;
    overflow-wrap: anywhere;
}

.swal2-popup.app-dialog .app-dialog-actions {
    width: 100%;
    margin: 22px 0 0;
    gap: 10px;
    justify-content: center;
}

.swal2-popup.app-dialog .app-dialog-btn {
    min-width: 130px;
    margin: 0;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.swal2-popup.app-dialog .app-dialog-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 55, 72, 0.3);
}

.swal2-popup.app-dialog .app-dialog-btn-primary {
    color: #ffffff;
    background-color: #2d3748;
    border-color: #2d3748;
}

.swal2-popup.app-dialog .app-dialog-btn-primary:hover {
    background-color: #1a202c;
    border-color: #1a202c;
}

.swal2-popup.app-dialog .app-dialog-btn-danger {
    color: #ffffff;
    background-color: #dc2626;
    border-color: #dc2626;
}

.swal2-popup.app-dialog .app-dialog-btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.swal2-popup.app-dialog .app-dialog-btn-danger:focus-visible {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.3);
}

.swal2-popup.app-dialog .app-dialog-btn-secondary {
    color: #334155;
    background-color: #ffffff;
    border-color: #cbd5e1;
}

.swal2-popup.app-dialog .app-dialog-btn-secondary:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

/* Softer backdrop than SweetAlert's default */
.swal2-container.swal2-backdrop-show:has(.app-dialog) {
    background: rgba(15, 23, 42, 0.45);
}

@media (max-width: 480px) {
    .swal2-popup.app-dialog {
        padding: 22px 18px 18px;
    }

    .swal2-popup.app-dialog .app-dialog-actions {
        flex-direction: column-reverse;
    }

    .swal2-popup.app-dialog .app-dialog-btn {
        width: 100%;
    }
}

/* ============================================================================
   Bulk modals (Helpers/BulkDecisionModal, Helpers/BulkStatusModal): accept/reject
   applicants and bulk-edit own posts. Global because both components share them.
   ============================================================================ */

.bdm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: bdm-fade-in 0.15s ease-out;
}

.bdm-card {
    width: min(480px, 100%);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2), 0 2px 6px rgba(15, 23, 42, 0.08);
    animation: bdm-pop-in 0.2s ease-out;
}

/* Header: colored icon chip, title, count, close */
.bdm-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.bdm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    font-size: 1.15rem;
}

.bdm-icon--accept {
    color: #15803d;
    background: #dcfce7;
}

.bdm-icon--reject {
    color: #b91c1c;
    background: #fee2e2;
}

.bdm-heading {
    flex: 1;
    min-width: 0;
}

.bdm-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 700;
    color: #1e293b;
}

.bdm-subtitle {
    margin: 2px 0 0;
    font-size: 0.86rem;
    color: #64748b;
}

.bdm-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.bdm-close:hover:not(:disabled) {
    background: #f1f5f9;
    color: #1e293b;
}

.bdm-body {
    padding: 16px 20px 4px;
    overflow-y: auto;
}

.bdm-section-label {
    margin: 0 0 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
}

/* Email choice as two selectable cards */
.bdm-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.bdm-option:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.bdm-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.bdm-option--selected {
    border-color: #2d3748;
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px #2d3748;
}

.bdm-option:has(input:focus-visible) {
    box-shadow: 0 0 0 3px rgba(45, 55, 72, 0.25);
}

.bdm-option-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
}

.bdm-option--selected .bdm-option-icon {
    background: #2d3748;
    color: #ffffff;
}

.bdm-option-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bdm-option-title {
    font-size: 0.93rem;
    font-weight: 600;
    color: #1e293b;
}

.bdm-option-desc {
    font-size: 0.82rem;
    color: #64748b;
}

.bdm-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.86rem;
    line-height: 1.45;
}

.bdm-note i {
    margin-top: 2px;
}

.bdm-note--info {
    color: #1e40af;
    background: #eff6ff;
}

.bdm-note--warn {
    color: #92400e;
    background: #fffbeb;
}

.bdm-irreversible {
    margin: 10px 0 12px;
    font-size: 0.8rem;
    color: #94a3b8;
}

.bdm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.bdm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.bdm-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.bdm-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 55, 72, 0.3);
}

.bdm-btn--secondary {
    color: #334155;
    background: #ffffff;
    border-color: #cbd5e1;
}

.bdm-btn--secondary:hover:not(:disabled) {
    background: #f1f5f9;
}

.bdm-btn--accept {
    color: #ffffff;
    background: #2d3748;
    border-color: #2d3748;
}

.bdm-btn--accept:hover:not(:disabled) {
    background: #1a202c;
}

.bdm-btn--reject {
    color: #ffffff;
    background: #dc2626;
    border-color: #dc2626;
}

.bdm-btn--reject:hover:not(:disabled) {
    background: #b91c1c;
}

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

@keyframes bdm-pop-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
    .bdm-footer {
        flex-direction: column-reverse;
    }

    .bdm-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bdm-backdrop,
    .bdm-card {
        animation: none;
    }
}

.bdm-icon--neutral {
    color: #2d3748;
    background: #f1f5f9;
}

/* Status picker of the bulk edit modal: one pill per status, colored like the status legend */
.bsm-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.bsm-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.bsm-status:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.bsm-status:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 55, 72, 0.25);
}

.bsm-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.bsm-status--published .bsm-status-dot { background: #16a34a; }
.bsm-status--unpublished .bsm-status-dot { background: #94a3b8; }
.bsm-status--withdrawn .bsm-status-dot { background: #dc2626; }

.bsm-status--selected {
    border-color: #2d3748;
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px #2d3748;
    color: #1e293b;
}

/* ============================================================================
   Detail / edit modals in the dashboards (Bootstrap modals tagged "app-modal"):
   one frame for all of them — backdrop, card, header, close button, footer.
   Only the frame changes; form contents and button colors stay as they are.
   !important is needed because these modals carry inline styles (and inline
   onmouseover color changes on the close button).
   ============================================================================ */

/* Extra class weight: some modals set their backdrop in scoped CSS, which loads after this file */
.modal.fade.show.app-modal {
    background-color: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.modal.app-modal .modal-content {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2), 0 2px 6px rgba(15, 23, 42, 0.08) !important;
    overflow: hidden;
}

.modal.app-modal .modal-header {
    padding: 16px 20px !important;
    background-color: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-radius: 16px 16px 0 0 !important;
    align-items: center;
    gap: 12px;
}

.modal.app-modal .modal-header .modal-title {
    color: #1e293b !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    line-height: 1.35;
}

.modal.app-modal .modal-header .modal-title i {
    color: #2d3748;
}

/* The header's only button is the close "×": a quiet ghost button */
.modal.app-modal .modal-header button {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px;
    padding: 0 !important;
    margin: 0 0 0 auto;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: none !important;
    border-radius: 10px !important;
    background-color: transparent !important;
    color: #64748b !important;
    opacity: 1;
    box-shadow: none !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.modal.app-modal .modal-header button:hover {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
}

.modal.app-modal .modal-header button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 55, 72, 0.25) !important;
}

.modal.app-modal .modal-header button span {
    color: inherit !important;
    font-size: 1.35rem !important;
    line-height: 1 !important;
}

/* Bootstrap's own close icon (btn-close) is drawn as a background image: keep it, just tone it */
.modal.app-modal .modal-header .btn-close {
    background-color: transparent !important;
    background-size: 0.75rem;
    opacity: 0.55;
}

.modal.app-modal .modal-header .btn-close:hover {
    opacity: 0.9;
}

.modal.app-modal .modal-footer {
    padding: 14px 20px !important;
    gap: 10px;
    background-color: #f8fafc !important;
    border-top: 1px solid #f1f5f9 !important;
    border-radius: 0 0 16px 16px !important;
}

.modal.app-modal .modal-footer > * {
    margin: 0;
}

/* Footer buttons keep their colors; only shape and weight are unified */
.modal.app-modal .modal-footer .btn,
.modal.app-modal .modal-footer .modern-button {
    border-radius: 10px !important;
    font-weight: 600;
    padding: 9px 18px !important;
}

@media (max-width: 576px) {
    .modal.app-modal .modal-dialog {
        margin: 12px;
    }
}
