/* =====================================================
   AI MPF - Application Styles
   ===================================================== */

.cursor-pointer { cursor: pointer; }

/* ---- Document Thumbnails ---- */
.doc-thumbs-row {
    margin-bottom: 4px;
}

.doc-thumb-wrapper {
    position: relative;
    margin-bottom: 4px;
}

.doc-thumb {
    width: 100%;
    min-height: 90px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    position: relative;
    transition: border-color .15s;
}
.doc-thumb:hover {
    border-color: #0d6efd;
}
.doc-thumb:hover .doc-thumb-overlay {
    opacity: 1;
}

.doc-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s;
}

.doc-thumb-img {
    width: 100%;
    height: 90px;
    object-fit: cover;
}

.doc-thumb-pdf {
    text-align: center;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.doc-thumb-label {
    font-size: 11px;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90%;
}

.doc-thumb-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 13px;
    border-radius: 50%;
    background: rgba(220,53,69,.85);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    line-height: 1;
    opacity: 0;
    transition: opacity .15s;
    cursor: pointer;
}
.doc-thumb-wrapper:hover .doc-thumb-delete {
    opacity: 1;
}

.doc-thumb-reextract {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 12px;
    border-radius: 50%;
    background: rgba(13,110,253,.85);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    line-height: 1;
    opacity: 0;
    transition: opacity .15s;
    cursor: pointer;
}
.doc-thumb-wrapper:hover .doc-thumb-reextract {
    opacity: 1;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinning {
    display: inline-block;
    animation: spin .6s linear infinite;
}

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1a1f36;
    --primary: #0d6efd;
}

/* Layout */
body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.wrapper {
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

/* Sidebar Nav */
#sidebar .nav-link {
    color: rgba(255,255,255,0.65);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    transition: all 0.15s;
    font-size: 0.9rem;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    background-color: rgba(255,255,255,0.12);
    color: #fff;
}

#sidebar .nav-link.active {
    background-color: rgba(13,110,253,0.25);
    color: #4da6ff;
}

/* Cards */
.card {
    border-radius: 12px;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
}

/* Tabs */
.nav-tabs .nav-link {
    border-radius: 8px 8px 0 0;
    font-weight: 500;
    color: #495057;
}

.nav-tabs .nav-link.active {
    font-weight: 600;
    color: var(--primary);
}

.tab-content {
    border-radius: 0 0 12px 12px;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed #dee2e6;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8f9fa;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: #e7f0ff;
}

.signature-zone,
.chop-zone,
.person-id-zone {
    cursor: pointer;
    transition: all 0.15s;
    border-style: dashed !important;
}
.signature-zone:hover,
.chop-zone:hover,
.person-id-zone:hover {
    border-color: var(--primary) !important;
    background: #f6faff !important;
}
.signature-zone.dragover,
.chop-zone.dragover,
.person-id-zone.dragover {
    border-color: var(--primary) !important;
    background: #e7f0ff !important;
    box-shadow: 0 0 0 3px rgba(13,110,253,.18);
}
.signature-zone * ,
.chop-zone *,
.person-id-zone * {
    pointer-events: auto;
}

/* Checkerboard so transparent PNGs are visibly transparent (not just white-on-white) */
.signature-preview,
.chop-preview {
    background-image:
        linear-gradient(45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(-45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e9ecef 75%),
        linear-gradient(-45deg, transparent 75%, #e9ecef 75%) !important;
    background-size: 12px 12px !important;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0px !important;
    background-color: #fff !important;
    cursor: zoom-in;
}
.signature-preview img,
.chop-preview img,
.person-id-preview img,
.person-id-preview .bi-file-pdf {
    cursor: zoom-in;
}
.person-id-preview { cursor: zoom-in; }

/* docPreviewModal body — transparency-aware variant (signature, chop) */
#docPreviewBody.preview-checker {
    background-color: #fff !important;
    background-image:
        linear-gradient(45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(-45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e9ecef 75%),
        linear-gradient(-45deg, transparent 75%, #e9ecef 75%) !important;
    background-size: 24px 24px !important;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0px !important;
    padding: 1.5rem !important;
}
#docPreviewBody.preview-checker img {
    max-height: 70vh !important;
}

.upload-zone.uploading {
    opacity: 0.6;
    pointer-events: none;
}

/* Doc cards */
.doc-card {
    transition: box-shadow 0.2s;
}
.doc-card.has-doc .upload-zone,
.doc-card.has-doc .card-footer { display: none; }

.doc-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.doc-item {
    background: #f8f9fa;
    font-size: 0.82rem;
}

/* Page content */
.page-content {
    background-color: #f0f2f5;
}

/* Tables */
.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    font-weight: 600;
}

/* Badges */
.badge {
    font-weight: 500;
}

/* Form sizing */
.form-control-sm, .form-select-sm {
    font-size: 0.875rem;
}

/* Placeholder color */
::placeholder {
    color: #b0b7c3 !important;
    opacity: 1;
}

/* Sidebar logo */
.sidebar-logo {
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
}

/* Toast container */
.toast-container {
    z-index: 9999;
}

/* Accordion */
.accordion-button:not(.collapsed) {
    background-color: #e7f0ff;
    color: #0d6efd;
}

/* Status badge in header */
.badge.fs-6 {
    font-size: 0.85rem !important;
    padding: 0.4em 0.75em;
}

/* Disabled generate button */
button:disabled {
    cursor: not-allowed;
}

/* Auth page */
body.auth-page {
    background: linear-gradient(135deg, #1a1f36 0%, #0d6efd 100%);
}

/* Quick upload zones (dashboard) */
.quick-upload-zone {
    border: 2px dashed #dee2e6;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8f9fa;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.quick-upload-zone:hover,
.quick-upload-zone.dragover {
    border-color: var(--primary);
    background: #e7f0ff;
}

.quick-upload-zone input[type="file"] {
    display: none;
}

@media (max-width: 767.98px) {
    .quick-upload-zone {
        min-height: 110px;
    }
}

/* Member CDF signature dropzone */
.member-cdf-sig-zone {
    border: 2px dashed #dee2e6;
    background: #f8f9fa;
    transition: border-color 0.15s, background 0.15s;
}

.member-cdf-sig-zone:hover,
.member-cdf-sig-zone.dragover {
    border-color: var(--primary);
    background: #e7f0ff;
}

.member-cdf-sig-zone.has-signature {
    border-style: solid;
    border-color: #cbd5e1;
    background: #fafafa;
}

/* Horizontally-scrollable nav-tabs row for mobile.
   On phones the 5 application tabs would otherwise wrap to two rows and
   look broken — this lets them slide sideways while staying as a tab strip. */
.nav-tabs-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Hide the small scrollbar that some mobile browsers paint */
    scrollbar-width: thin;
}
.nav-tabs-scroll-wrap > .nav-tabs {
    flex-wrap: nowrap;
    border-bottom: 1px solid #dee2e6;
}

