/* ========================================
   Common Components CSS
   Toast notifications, confirmation dialog,
   and modal z-index management.
   Aligned with RojgaarSangam design tokens.
   ======================================== */

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    z-index: 1500;
}

.toast {
    min-width: 320px;
    max-width: 420px;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.hiding {
    transform: translateX(100%);
}

.toast-header {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: none;
}

.toast-body {
    padding: 10px 14px;
    font-weight: 500;
    font-size: 13px;
}

/* --- Success --- */
.toast-success {
    background: #f0fdf4;
    border-left: 4px solid #16a34a;
}

.toast-success .toast-header {
    background: #dcfce7;
    color: #166534;
}

.toast-success .toast-body {
    color: #15803d;
}

/* --- Danger --- */
.toast-danger {
    background: #fef2f2;
    border-left: 4px solid #dc2626;
}

.toast-danger .toast-header {
    background: #fee2e2;
    color: #991b1b;
}

.toast-danger .toast-body {
    color: #b91c1c;
}

/* --- Warning --- */
.toast-warning {
    background: #fffbeb;
    border-left: 4px solid #d97706;
}

.toast-warning .toast-header {
    background: #fef3c7;
    color: #92400e;
}

.toast-warning .toast-body {
    color: #b45309;
}

/* --- Info --- */
.toast-info {
    background: #f0f9ff;
    border-left: 4px solid #0284c7;
}

.toast-info .toast-header {
    background: #e0f2fe;
    color: #075985;
}

.toast-info .toast-body {
    color: #0369a1;
}

/* ========================================
   MODAL Z-INDEX MANAGEMENT
   ======================================== */

.modal-backdrop {
    z-index: 1250 !important;
}

/* Standard modals (edit, view, etc.) — above header */
.modal:not(#confirmationModal) {
    z-index: 1300 !important;
}

.modal:not(#confirmationModal) .modal-dialog {
    z-index: 1301 !important;
}

.modal:not(#confirmationModal) .modal-content {
    z-index: 1302 !important;
}

/* Confirmation modal — highest priority.
   Public pages load this stylesheet without Bootstrap CSS, so the closed
   dialog must be taken out of the document flow here. Bootstrap's modal
   script sets an inline display when the dialog is opened. */
#confirmationModal {
    position: fixed;
    top: 0;
    left: 0;
    display: none;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    z-index: 1400 !important;
}

#confirmationModal.show {
    display: block;
}

#confirmationModal .modal-dialog {
    z-index: 1401 !important;
    position: relative;
}

#confirmationModal .modal-content {
    z-index: 1402 !important;
    position: relative;
}

/* ========================================
   STANDARD MODAL STYLING
   ======================================== */
.modal-content {
    border: none;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18), 0 4px 16px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.modal-header {
    padding: 18px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.2px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 6px 24px;
    background: #f8fafc;
    border-top: none;
    gap: 10px;
    margin-top: 25px;
}

/* ========================================
   CONFIRMATION DIALOG
   ======================================== */
.confirmation-modal {
    border: none;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.confirmation-modal .modal-header {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    border: none;
    padding: 20px;
    position: relative;
}

.confirmation-modal .modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent);
    pointer-events: none;
}

.confirmation-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
}

.confirmation-icon i {
    font-size: 1.2rem;
    color: #fff;
}

.confirmation-modal .modal-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff;
    margin: 0;
    position: relative;
    z-index: 1;
}

.confirmation-modal .btn-close {
    filter: invert(1);
    opacity: 0.8;
    position: relative;
    z-index: 1;
}

.confirmation-modal .btn-close:hover {
    opacity: 1;
}

.confirmation-modal .modal-body {
    padding: 24px 20px;
    background: #fff;
}

.confirmation-modal #confirmationMessage {
    font-size: 15px;
    color: #334155;
    margin-bottom: 8px;
    font-weight: 500;
    line-height: 1.5;
}

.confirmation-details {
    background: #f8fafc;
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 3px solid #dc2626;
    font-size: 13px;
    color: #64748b;
}

.confirmation-modal .modal-footer {
    background: #f8fafc;
    border-top: none;
    padding: 14px 20px;
    gap: 8px;
}

.confirmation-modal .btn {
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.15s ease;
    border: none;
}

.confirmation-modal .btn-secondary {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}

.confirmation-modal .btn-secondary:hover {
    background: #e2e8f0 !important;
}

.confirmation-modal .btn-danger {
    background: #dc2626 !important;
    color: #fff !important;
}

.confirmation-modal .btn-danger:hover {
    background: #b91c1c !important;
}

.confirmation-modal .btn-warning {
    background: #d97706 !important;
    color: #fff !important;
}

.confirmation-modal .btn-warning:hover {
    background: #b45309 !important;
}

.confirmation-modal .btn-success {
    background: #16a34a !important;
    color: #fff !important;
}

.confirmation-modal .btn-success:hover {
    background: #15803d !important;
}

.confirmation-modal .btn-info {
    background: #0284c7 !important;
    color: #fff !important;
}

.confirmation-modal .btn-info:hover {
    background: #0369a1 !important;
}

.confirmation-modal .btn i {
    margin-right: 6px;
}

/* ========================================
   IMAGE DROPZONE UPLOADER
   ======================================== */
.bz-image-dropzone {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: rgb(183 183 183 / 10%);
    border: 2px dashed var(--dx-color-border, #dee2e6);
    padding: 10px;
    border-radius: 8px;
    transition: all .3s ease;
    position: relative;
}

.bz-image-dropzone > * {
    pointer-events: none;
}

.bz-image-dropzone.dropzone-active {
    border-style: solid;
    border-color: var(--dx-color-primary, #007bff);
    background-color: rgba(0, 123, 255, .1);
}

.bz-image-dropzone img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.bz-dropzone-text > span {
    font-weight: 100;
    opacity: .5;
    text-align: center;
}

.bz-image-view-btn {
    pointer-events: auto !important;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    opacity: .7;
    transition: opacity .2s;
}

.bz-image-view-btn:hover {
    opacity: 1;
}

.bz-image-remove-btn {
    right: 44px;
}

.bz-flex-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ========================================
   DOCUMENT UPLOADER & PREVIEW
   ======================================== */
.bz-doc-uploader {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background-color: #f8f9fa;
}

.bz-doc-uploader:hover {
    border-color: #007bff;
    background-color: #e3f2fd;
}

.bz-upload-grid {
    align-items: stretch;
}

.bz-upload-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.bz-upload-item .form-label {
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.bz-upload-item .form-text {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}

.bz-upload-item .dx-fileuploader {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 8px;
}

/* ----------------------------------------------------------------------
   Unified file upload control (used by Views/Shared/_FileUploadField.cshtml)

   Two variants share the same internal markup:
     .bz-file-upload--card    : block style with chrome (default).
     .bz-file-upload--inline  : compact, full-width, no chrome; designed to
                                sit inside a DevExtreme form template item
                                next to text editors.
   ---------------------------------------------------------------------- */

.bz-file-upload {
    display: block;
    box-sizing: border-box;
}

.bz-file-upload__field {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.bz-file-upload__label {
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    display: block;
}

.bz-file-upload__help {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}

.bz-file-upload__file {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-width: 0;
}

.bz-file-upload__file .file-icon {
    font-size: 22px;
    color: #475569;
    flex: 0 0 auto;
}

.bz-file-upload__file .file-info {
    flex: 1 1 auto;
    min-width: 0;
}

.bz-file-upload__file .file-name {
    font-weight: 500;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bz-file-upload__file .file-size {
    font-size: 12px;
    color: #64748b;
}

/* Inline variant: chromeless, follows the form column width. */
.bz-file-upload--inline {
    width: 100%;
    max-width: 100%;
}

.bz-file-upload--inline .bz-file-upload__field {
    background: transparent;
    border: 0;
    padding: 0;
    box-shadow: none;
}

/* The inline document dropzone presents a single dashed surface that matches
   the height of an outlined text editor next to it. */
.bz-file-upload--inline .bz-file-upload__doc-dropzone {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    padding: 6px 8px;
    transition: border-color .2s ease, background-color .2s ease;
}

.bz-file-upload--inline .bz-file-upload__doc-dropzone:hover,
.bz-file-upload--inline .bz-file-upload__doc-dropzone.dropzone-active {
    border-color: #2563eb;
    background-color: rgba(37, 99, 235, 0.05);
}

.bz-file-upload--inline .dx-fileuploader,
.bz-file-upload--inline .dx-fileuploader-wrapper,
.bz-file-upload--inline .dx-fileuploader-input-wrapper {
    background: transparent;
    border: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.bz-doc-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.bz-doc-preview .btn {
    flex: 0 0 auto;
}

.bz-doc-preview .file-icon {
    font-size: 24px;
    flex: 0 0 auto;
}

.bz-doc-preview .file-info {
    flex: 1 1 auto;
    min-width: 0;
}

.bz-doc-preview .file-name {
    font-weight: 500;
    color: #495057;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bz-doc-preview .file-size {
    font-size: 12px;
    color: #6c757d;
}

.bz-detail-image-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.bz-detail-image-preview {
    position: relative;
    width: 180px;
    height: 120px;
    overflow: hidden;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    cursor: pointer;
}

.bz-detail-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bz-detail-image-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(15, 23, 42, .35);
    opacity: 0;
    transition: opacity .2s ease;
}

.bz-detail-image-preview:hover .bz-detail-image-overlay {
    opacity: 1;
}

.bz-detail-file-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bz-detail-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.bz-detail-file-row .btn-group,
.bz-detail-file-row .btn,
.bz-detail-file-row i {
    flex: 0 0 auto;
}

.bz-detail-file-name {
    color: #334155;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 576px) {
    .toast {
        min-width: 280px;
        margin: 8px;
    }

    .confirmation-modal .modal-dialog {
        margin: 16px;
    }

    .confirmation-modal .modal-header {
        padding: 16px;
    }

    .confirmation-modal .modal-body {
        padding: 20px 16px;
    }

    .confirmation-modal .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }

    .confirmation-modal .btn {
        width: 100%;
    }
}

/* PPTX in-browser preview */
.bz-pptx-preview-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
}

.bz-pptx-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.bz-pptx-toolbar-divider {
    width: 1px;
    height: 22px;
    background: #cbd5e1;
    margin: 0 2px;
}

.bz-pptx-preview-stage {
    flex: 1 1 auto;
    overflow: auto;
    padding: 16px;
    text-align: center;
    cursor: zoom-in;
}

.bz-pptx-preview-stage canvas {
    display: block;
    margin: 0 auto;
    height: auto;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    background: #fff;
}
