/* ===== Document Detail & Sign Pages ===== */
/* Used by: document.html, document_sign_page.html */

/* ---------- Layout wrapper ---------- */
.doc-page-wrap {
    max-width: 1280px;
    width: 95%;
    margin: 0 auto;
    padding: 100px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    overflow: hidden;
}

.doc-page-content {
    display: flex;
    gap: 32px;
    overflow: hidden;
}

/* ---------- Document title ---------- */
.doc-page-title {
    font-size: 24px;
    font-weight: 700;
    color: #12294B;
    margin: 0;
    padding: 0 4px;
}

/* ---------- Document text area ---------- */
.doc-page-text {
    flex: 1;
    min-width: 0;
    max-width: 75%;
    border: 1px solid #e0e6ee;
    border-radius: 16px;
    padding: 24px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(18, 41, 75, 0.04);
    overflow: auto;
}

@media (max-width: 600px) {
    .doc-page-text--hide-mobile {
        display: none;
    }
}

/* ---------- Language toggle ---------- */
.doc-lang-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.doc-lang-sep {
    width: 1px;
    height: 20px;
    background: #e0e6ee;
    margin: 0 8px;
}

.doc-lang-btn {
    padding: 4px 10px;
    border: 1px solid #e0e6ee;
    border-radius: 6px;
    background: #f8f9fb;
    color: #5a6a7e;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.doc-lang-btn:hover {
    background: #e0e6ee;
    color: #12294B;
}

.doc-lang-btn.active {
    background: #12294B;
    color: #fff;
    border-color: #12294B;
}

/* Hide columns based on language — only .doc-bilingual table */
.doc-lang--kz table.doc-bilingual > tbody > tr > td:nth-child(2),
.doc-lang--kz table.doc-bilingual > tbody > tr > th:nth-child(2) {
    display: none;
}

.doc-lang--kz table.doc-bilingual > tbody > tr > td:first-child,
.doc-lang--kz table.doc-bilingual > tbody > tr > th:first-child {
    width: 100% !important;
}

.doc-lang--ru table.doc-bilingual > tbody > tr > td:first-child,
.doc-lang--ru table.doc-bilingual > tbody > tr > th:first-child {
    display: none;
}

.doc-lang--ru table.doc-bilingual > tbody > tr > td:nth-child(2),
.doc-lang--ru table.doc-bilingual > tbody > tr > th:nth-child(2) {
    width: 100% !important;
}
.doc-lang--ru table.doc-bilingual--bordered > tbody > tr > td:nth-child(2),
.doc-lang--ru table.doc-bilingual--bordered > tbody > tr > th:nth-child(2) {
    border-left: 1px solid black !important;
}

@media (max-width: 640px) {
    .doc-page-text .tpl-zoom-bar {
        flex-wrap: wrap;
    }
    .doc-lang-toggle {
        margin-left: 0;
        width: 100%;
        padding-top: 10px;
        border-top: 1px solid #f0f2f7;
        margin-top: 6px;
    }
    .doc-lang-sep {
        display: none;
    }
}

/* ---------- Sidebar ---------- */
.doc-page-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 25%;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .doc-page-sidebar {
        width: 100%;
    }
}

/* ---------- Cards ---------- */
.doc-card {
    background: #fff;
    border: 1px solid rgba(18, 41, 75, 0.06);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(18, 41, 75, 0.04);
}

.doc-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #12294B;
    margin: 0 0 16px 0;
}

/* ---------- Side block ---------- */
.doc-side-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.doc-side-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #12294B;
    margin: 0;
}

.doc-side-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---------- Form elements ---------- */
.doc-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doc-label {
    font-size: 13px;
    font-weight: 600;
    color: #5a6a7e;
}

.doc-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e6ee;
    border-radius: 10px;
    background: #f8f9fb;
    font-size: 14px;
    color: #12294B;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}

.doc-input:focus {
    border-color: #3657CD;
    box-shadow: 0 0 0 3px rgba(54, 87, 205, 0.1);
    background: #fff;
}

.doc-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f0f2f7;
}

.doc-select {
    width: 100%;
    max-width: 180px;
    padding: 8px 12px;
    border: 1px solid #e0e6ee;
    border-radius: 10px;
    background: #f8f9fb;
    font-size: 13px;
    color: #12294B;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    appearance: auto;
}

.doc-select:focus {
    border-color: #3657CD;
}

.doc-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- Buttons ---------- */
.doc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    text-decoration: none;
    text-align: center;
    line-height: 1.4;
    width: 100%;
    box-sizing: border-box;
}

.doc-btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.doc-btn:active {
    transform: translateY(0);
}

.doc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.doc-btn--primary {
    background: linear-gradient(135deg, #3657CD, #12294B);
    color: #fff;
    box-shadow: 0 2px 8px rgba(54, 87, 205, 0.25);
}

.doc-btn--primary:hover {
    box-shadow: 0 4px 16px rgba(54, 87, 205, 0.35);
    color: #fff;
}

.doc-btn--secondary {
    background: var(--color-blue-dark, #12294B);
    color: #ffffff;
}

.doc-btn--secondary:hover {
    opacity: 0.9;
    color: #ffffff;
}

.doc-btn--outline {
    background: #ffffff;
    color: #12294B;
    border: 1.5px solid #e0e6ee;
}

.doc-btn--outline:hover {
    border-color: var(--color-blue-dark, #12294B);
    background: #f8f9fb;
    color: #12294B;
}

.doc-btn--danger {
    background: #dc3545;
    color: #fff;
}

.doc-btn--danger:hover {
    background: #c82333;
    color: #fff;
}

.doc-btn--sm {
    padding: 8px 14px;
    font-size: 13px;
}

/* ---------- Status chips ---------- */
.doc-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.doc-status-chip--success {
    background: #e8f5e9;
    color: #2e7d32;
}

.doc-status-chip--warning {
    background: #fff8e1;
    color: #e65100;
}

.doc-status-chip--info {
    background: #e3f2fd;
    color: #1565c0;
}

.doc-status-chip--neutral {
    background: #f0f2f7;
    color: #5a6a7e;
}

/* ---------- Status badge (small pill) ---------- */
.doc-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.doc-status-badge--signed {
    background: #2e7d32;
    color: #fff;
}

.doc-status-badge--pending {
    background: #e65100;
    color: #fff;
}

/* ---------- Registration indicator ---------- */
.doc-reg-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #5a6a7e;
    margin: 4px 0;
}

.doc-reg-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.doc-reg-dot--active {
    background: #2e7d32;
}

.doc-reg-dot--inactive {
    background: #dc3545;
}

/* ---------- Side phone ---------- */
.doc-side-phone {
    font-size: 14px;
    color: #5a6a7e;
    margin: 4px 0;
}

/* ---------- Side status ---------- */
.doc-side-status {
    font-size: 15px;
    font-weight: 700;
    margin: 4px 0;
}

.doc-side-status--signed {
    color: #2e7d32;
}

.doc-side-status--pending {
    color: #e65100;
}

/* ---------- Funnel section ---------- */
.doc-funnel-section {
    margin-top: 8px;
}

.doc-funnel-step {
    font-size: 13px;
    color: #5a6a7e;
    margin-top: 4px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.doc-funnel-check {
    color: #2e7d32;
    font-weight: 700;
    flex-shrink: 0;
}

.doc-funnel-check--fail {
    color: #dc3545;
}

.doc-funnel-auto {
    color: #1565c0;
    font-style: italic;
    font-size: 12px;
}

.doc-funnel-count {
    color: #8a95a5;
    font-size: 12px;
}

/* ---------- Funnel side card (inside sidebar) ---------- */
.doc-funnel-side-card {
    background: #f8f9fb;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 10px;
}

.doc-funnel-side-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-funnel-side-name {
    font-weight: 600;
    font-size: 14px;
    color: #12294B;
}

.doc-funnel-side-phone {
    color: #8a95a5;
    font-size: 13px;
    margin-top: 2px;
}

/* ---------- Autosign notice ---------- */
.doc-autosign-notice {
    padding: 10px 14px;
    background: #e3f2fd;
    border-left: 3px solid #1565c0;
    border-radius: 6px;
    margin-bottom: 12px;
}

.doc-autosign-title {
    font-size: 13px;
    font-weight: 600;
    color: #1565c0;
}

.doc-autosign-text {
    font-size: 12px;
    color: #5a6a7e;
    margin-top: 4px;
    line-height: 1.5;
}

/* ---------- Funnel detail overlay (modal) ---------- */
.doc-funnel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 41, 75, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.doc-funnel-modal {
    background: #fff;
    border-radius: 20px;
    width: 90%;
    max-width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(18, 41, 75, 0.2);
}

.doc-funnel-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e6ee;
}

.doc-funnel-modal-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #12294B;
}

.doc-funnel-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f0f2f7;
    border-radius: 8px;
    cursor: pointer;
    color: #5a6a7e;
    transition: background 0.2s;
}

.doc-funnel-modal-close:hover {
    background: #e0e6ee;
}

.doc-funnel-modal-close svg {
    width: 16px;
    height: 16px;
}

.doc-funnel-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.doc-funnel-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e6ee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* ---------- Funnel detail cards ---------- */
.doc-funnel-detail-card {
    background: #f8f9fb;
    border: 1px solid #e0e6ee;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.doc-funnel-detail-card:last-child {
    margin-bottom: 0;
}

.doc-funnel-detail-title {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 700;
    color: #12294B;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e6ee;
}

.doc-funnel-detail-side-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e6ee;
    margin-bottom: 12px;
}

.doc-funnel-detail-side-name {
    font-size: 15px;
    font-weight: 700;
    color: #12294B;
    margin: 0;
}

.doc-funnel-detail-side-meta {
    font-size: 13px;
    color: #8a95a5;
    margin-top: 2px;
}

/* Funnel detail step */
.doc-funnel-detail-step {
    margin-bottom: 12px;
}

.doc-funnel-detail-step:last-child {
    margin-bottom: 0;
}

.doc-funnel-detail-step-title {
    font-weight: 600;
    font-size: 14px;
    color: #12294B;
    margin-bottom: 6px;
}

.doc-funnel-detail-event {
    font-size: 13px;
    color: #5a6a7e;
    padding-left: 16px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.doc-funnel-detail-event + .doc-funnel-detail-event {
    border-top: 1px dashed #e0e6ee;
}

.doc-funnel-detail-event strong {
    color: #12294B;
}

/* ---------- Button with hint (popover) ---------- */
.doc-btn-with-hint {
    position: relative;
}

.doc-btn-hint-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.2s;
}

.doc-btn-hint-icon:hover {
    opacity: 1;
}

/* ---------- Sidebar buttons stack ---------- */
.doc-sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 4px;
}

/* ---------- Consent link ---------- */
.doc-consent-link {
    font-size: 13px;
    color: #dc3545;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.doc-consent-link:hover {
    opacity: 0.7;
}

.doc-consent-withdrawn {
    font-size: 13px;
    color: #8a95a5;
}

/* ---------- Countdown ---------- */
.doc-countdown {
    text-align: center;
    font-size: 13px;
    color: #5a6a7e;
    margin-top: 8px;
}

/* ---------- Divider ---------- */
.doc-divider {
    border: none;
    border-top: 1px solid #e0e6ee;
    margin: 12px 0;
}

/* ---------- Error message ---------- */
.doc-error-msg {
    color: #dc3545;
    text-align: center;
    font-size: 13px;
    min-height: 18px;
}

/* ---------- Scroll nav button ---------- */
.doc-scroll-nav-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    background: linear-gradient(135deg, #3657CD 0%, #12294B 100%);
    color: #fff;
    border: none;
    border-radius: 28px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(18, 41, 75, 0.25);
    transition: opacity 0.3s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.doc-scroll-nav-btn:hover {
    transform: translateY(-2px);
}

.doc-scroll-nav-btn:active {
    opacity: 0.8;
    transform: translateY(0);
}

.doc-scroll-nav-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s;
}

.doc-scroll-nav-btn.scroll-up svg {
    transform: rotate(180deg);
}

@media (max-height: 400px) {
    .doc-scroll-nav-btn {
        display: none;
    }
}

/* ---------- Sidebar slider (sign page mobile) ---------- */
.doc-sidebar-slider {
    display: flex;
    flex-direction: column;
    width: 25%;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid rgba(18, 41, 75, 0.06);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(18, 41, 75, 0.04);
    padding: 8px 0;
    position: relative;
    height: fit-content;
}

@media (max-width: 640px) {
    .doc-sidebar-slider {
        width: 100%;
        border-radius: 16px;
    }
}

/* ---------- Sidebar section padding ---------- */
.doc-sidebar-section {
    padding: 12px 20px;
}

/* ---------- Image list (from file docs) ---------- */
.doc-images-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.doc-images-list img {
    width: 100%;
    border-radius: 8px;
}

/* ---------- Toast notification ---------- */
.doc-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #12294B;
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 11000;
    box-shadow: 0 8px 32px rgba(18, 41, 75, 0.3);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    pointer-events: none;
}

.doc-toast--visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ---------- Side name partial ---------- */

.side-name-text {
    font-weight: 700;
    color: #12294B;
}

/* ---------- Print styles ---------- */
/* ---------- Mobile layout ---------- */
@media (max-width: 640px) {
    .doc-page-wrap {
        padding: 80px 8px 40px;
        width: 100%;
        gap: 16px;
    }
    .doc-page-content {
        flex-direction: column-reverse;
        gap: 16px;
        overflow: visible;
    }
    .doc-page-text {
        max-width: none;
        width: 100%;
        overflow: hidden;
        padding: 12px;
        box-sizing: border-box;
    }
    .doc-page-text table {
        width: 100% !important;
        table-layout: fixed;
    }
    .doc-sidebar-slider {
        width: 100%;
    }
}

/* ---------- Print styles ---------- */
@media print {
    .doc-funnel-modal-footer,
    .doc-funnel-modal-close {
        display: none;
    }
    .doc-funnel-modal {
        max-height: none;
        box-shadow: none;
    }
}