/* Terms modal */

/* ===== Desktop ===== */

.term-doc {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
}

.term-doc h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #004080;
}

.term-doc h2 {
    font-size: 22px;
    margin-top: 40px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 5px;
}

.term-doc h3 {
    margin-top: 25px;
    color: #333;
}

.term-doc ul {
    margin-left: 20px;
}

.term-doc ol {
    margin-left: 20px;
}

.term-doc .note {
    color: #b30000;
    font-weight: bold;
}

.term-doc .warning {
    background-color: #fff4f4;
    border-left: 4px solid #cc0000;
    padding: 10px 15px;
    margin: 15px 0;
    color: #990000;
}

.term-doc .section {
    margin-bottom: 40px;
}

.term-doc .meta {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 30px;
}

.term-doc a {
    overflow-wrap: anywhere;
}

.term-doc .terms-note {
    text-align: center;
    color: #555;
    font-size: 15px;
    margin-bottom: 30px;
}

.term-doc .info {
    background-color: #f4f9f4;
    border-left: 4px solid #2e7d32;
    padding: 10px 15px;
    margin: 15px 0;
    color: #1b5e20;
}

.term-doc table.legal {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 14px;
}

.term-doc table.legal th,
.term-doc table.legal td {
    border: 1px solid #ddd;
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.term-doc table.legal th {
    background-color: #f0f4f8;
}

#termModal,
#summernotePreviewModal {
    z-index: 2000;
}

#termModal .modal-dialog,
#summernotePreviewModal .modal-dialog {
    max-width: 760px;
    width: calc(100% - 24px);
    margin: 1.25rem auto;
}

#termModal .modal-content,
#summernotePreviewModal .modal-content {
    border: none;
    border-radius: 10px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

#termModal .modal-header,
#summernotePreviewModal .modal-header {
    border-bottom: 1px solid #eee;
    padding: 16px 20px;
    flex-shrink: 0;
}

#termModal .modal-title,
#summernotePreviewModal .modal-title {
    font-size: 17px;
    font-weight: 600;
    color: #222;
}

#termModal .modal-body,
#summernotePreviewModal .modal-body {
    padding: 0 16px 8px;
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#termScrollBox,
#summernotePreviewBox {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(92vh - 170px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 8px 8px 16px 4px;
}

#termModal .modal-footer.term-footer,
#summernotePreviewModal .modal-footer {
    display: block;
    border-top: 1px solid #eee;
    padding: 12px 20px 16px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 0 0 10px 10px;
}

.term-hint {
    color: #c0392b;
    font-size: 13px;
    margin-bottom: 8px;
}

.term-agree-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 12px;
}

#termModal .term-agree-wrap [type="checkbox"] + label.term-agree-label {
    margin: 0;
    height: auto;
    line-height: 1.45;
    white-space: normal;
    padding-left: 32px;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    display: inline-block;
    cursor: pointer;
}

#btnAcceptTerm {
    min-width: 110px;
}

#btnAcceptTerm:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.modal-backdrop.term-backdrop {
    z-index: 1990;
    background: #000;
}

body.terms-modal-open .page-wrapper,
body.terms-modal-open .left-sidebar,
body.terms-modal-open .topbar {
    filter: blur(3px);
    pointer-events: none;
    user-select: none;
}

#termThanksModal {
    z-index: 2010;
}

#termThanksModal .modal-dialog {
    max-width: 380px;
    margin: 1.75rem auto;
}

#termThanksModal .modal-content {
    border: none;
    border-radius: 12px;
    padding: 28px 24px 24px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.term-thanks-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    border: 3px solid #82e0aa;
    color: #27ae60;
    font-size: 34px;
    line-height: 66px;
    font-weight: 700;
}

.term-thanks-text {
    font-size: 16px;
    color: #222;
    margin: 0 0 22px;
    font-weight: 500;
}

#btnTermThanksOk {
    min-width: 120px;
    padding: 8px 28px;
}

/* ===== Tablet ===== */

@media (max-width: 992px) {
    .term-doc h1 {
        font-size: clamp(17px, 5.2vw, 24px);
    }

    .term-doc h1 .t-sep {
        display: none;
    }

    .term-doc h1 .t-domain {
        display: block;
    }

    .term-doc h2 {
        font-size: 20px;
        margin-top: 28px;
    }

    .term-doc h3 {
        font-size: 17px;
        margin-top: 20px;
    }

    .term-doc table.legal {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .term-doc table.legal th,
    .term-doc table.legal td {
        min-width: 120px;
    }

    #termModal .modal-dialog,
    #summernotePreviewModal .modal-dialog {
        max-width: calc(100% - 32px);
        width: calc(100% - 32px);
        margin: 0.75rem auto;
    }

    #termModal .modal-content,
    #summernotePreviewModal .modal-content {
        max-height: calc(100dvh - 1.5rem);
        max-height: calc(100vh - 1.5rem);
    }

    #termScrollBox,
    #summernotePreviewBox {
        max-height: calc(100dvh - 200px);
        max-height: calc(100vh - 200px);
    }
}

/* ===== Mobile ===== */

@media (max-width: 768px) {
    .term-doc h2 {
        font-size: 18px;
        margin-top: 24px;
    }

    .term-doc h3 {
        font-size: 16px;
        margin-top: 18px;
    }

    .term-doc ul,
    .term-doc ol {
        margin-left: 16px;
        padding-left: 0;
    }

    .term-doc .meta,
    .term-doc .terms-note {
        font-size: 13px;
    }

    .term-doc .warning,
    .term-doc .info {
        padding: 8px 12px;
        font-size: 14px;
    }

    .term-doc table.legal {
        font-size: 13px;
    }

    .term-doc table.legal th,
    .term-doc table.legal td {
        padding: 6px 8px;
        min-width: 100px;
    }

    #termModal .modal-dialog.modal-dialog-centered,
    #summernotePreviewModal .modal-dialog.modal-dialog-centered {
        align-items: center;
        justify-content: center;
        min-height: calc(100% - 1rem);
        margin: 0.5rem auto;
        width: calc(100% - 24px);
        max-width: calc(100% - 24px);
        height: auto;
        max-height: none;
    }

    #termModal .modal-dialog,
    #summernotePreviewModal .modal-dialog {
        height: auto;
        max-height: none;
    }

    #termModal .modal-content,
    #summernotePreviewModal .modal-content {
        border-radius: 10px;
        height: calc(100dvh - 100px);
        height: calc(100vh - 100px);
        max-height: calc(100dvh - 100px);
        max-height: calc(100vh - 100px);
        min-height: 0;
        width: 100%;
    }

    #termModal .modal-header,
    #summernotePreviewModal .modal-header {
        padding: 10px 14px;
    }

    #termModal .modal-title,
    #summernotePreviewModal .modal-title {
        font-size: 14px;
        line-height: 1.35;
        padding-right: 4px;
    }

    #termModal .modal-body,
    #summernotePreviewModal .modal-body {
        padding: 0 10px 4px;
    }

    #termScrollBox,
    #summernotePreviewBox {
        max-height: none;
        padding: 4px 2px 8px 0;
    }

    #termModal .modal-footer.term-footer,
    #summernotePreviewModal .modal-footer {
        padding: 8px 12px 10px;
    }

    .term-hint {
        font-size: 12px;
        line-height: 1.4;
    }

    #termModal .term-agree-wrap [type="checkbox"] + label.term-agree-label {
        font-size: 13px;
        padding-left: 28px;
    }

    #termThanksModal .modal-dialog {
        width: calc(100% - 32px);
        max-width: 100%;
        margin: 1rem auto;
    }

    #termThanksModal .modal-content {
        padding: 24px 20px 20px;
    }
}

/* Viewport 430px */
@media (max-width: 430px) {
    #termModal .modal-dialog.modal-dialog-centered,
    #summernotePreviewModal .modal-dialog.modal-dialog-centered {
        width: calc(100% - 16px);
        max-width: calc(100% - 16px);
    }

    #termModal .modal-content,
    #summernotePreviewModal .modal-content {
        height: calc(100dvh - 100px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        max-height: calc(100dvh - 100px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }

    #termModal .modal-footer.term-footer,
    #summernotePreviewModal .modal-footer {
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    #termModal .modal-footer .d-flex {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }

    .term-agree-wrap {
        padding-right: 0;
    }

    #btnAcceptTerm {
        width: 100%;
        min-width: 0;
    }
}
