/**
 * Limenco Terms & Conditions Popup Styles
 */

/* Prevent body scroll when popup is open */
body.limenco-terms-popup-open {
    overflow: hidden;
}

/* Popup overlay */
.limenco-terms-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.limenco-terms-popup-overlay.active {
    display: flex;
    opacity: 1;
}

/* Popup container */
.limenco-terms-popup {
    background: #fff;
    border-radius: 8px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.limenco-terms-popup-overlay.active .limenco-terms-popup {
    transform: scale(1);
}

/* Header */
.limenco-terms-popup-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.limenco-terms-popup-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #333;
}

.limenco-terms-popup-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.limenco-terms-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Table of Contents */
.limenco-terms-popup-toc {
    padding: 15px 25px;
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    max-height: 200px;
    overflow-y: auto;
}

.limenco-terms-popup-toc:empty {
    display: none;
}

.limenco-terms-popup-toc .toc-header {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

.limenco-terms-popup-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.limenco-terms-popup-toc li {
    margin: 0;
    padding: 0;
}

.limenco-terms-popup-toc li.toc-level-3 {
    padding-left: 20px;
}

.limenco-terms-popup-toc a {
    display: block;
    padding: 5px 10px;
    color: #2563eb;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    transition: background 0.2s ease;
}

.limenco-terms-popup-toc a:hover {
    background: #e3f2fd;
}

/* Content area */
.limenco-terms-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    font-size: 15px;
    line-height: 1.6;
    color: #444;
}

.limenco-terms-popup-content h2 {
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.limenco-terms-popup-content h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.limenco-terms-popup-content h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 17px;
    font-weight: 600;
    color: #444;
}

.limenco-terms-popup-content p {
    margin-bottom: 15px;
}

.limenco-terms-popup-content ul,
.limenco-terms-popup-content ol {
    margin-bottom: 15px;
    padding-left: 25px;
}

.limenco-terms-popup-content li {
    margin-bottom: 8px;
}

.limenco-terms-popup-content .loading,
.limenco-terms-popup-content .error {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.limenco-terms-popup-content .error {
    color: #d32f2f;
}

/* Footer */
.limenco-terms-popup-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.limenco-terms-scroll-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f57c00;
    font-size: 14px;
    font-weight: 500;
}

.limenco-terms-scroll-notice .dashicon {
    width: 20px;
    height: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.limenco-terms-popup-accept-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
}

.limenco-terms-popup-accept-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    user-select: none;
    flex: 1;
}

.limenco-terms-popup-accept-label:has(.limenco-terms-popup-accept-checkbox:disabled) {
    opacity: 0.6;
    cursor: not-allowed;
}

.limenco-terms-popup-accept-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.limenco-terms-popup-accept-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.limenco-terms-popup-submit {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.limenco-terms-popup-submit:hover:not(:disabled) {
    background: #1d4ed8;
}

.limenco-terms-popup-submit:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Acceptance wrapper in form */
.limenco-terms-acceptance-wrapper {
    margin: 20px 0;
    position: relative;
}

.limenco-terms-acceptance-wrapper.validation-error {
    padding: 15px;
    background: #fff8f8;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.limenco-terms-acceptance-wrapper .wpcf7-not-valid-tip {
    display: block;
    color: #d32f2f;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
    padding-left: 30px;
}

.limenco-terms-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.limenco-terms-checkbox {
    margin-top: 3px;
    cursor: pointer;
    pointer-events: none; /* Prevent direct clicking - must use popup */
}

.limenco-terms-checkbox:not(:checked) {
    opacity: 0.7;
}

.limenco-terms-checkbox:checked {
    opacity: 1;
}

.limenco-terms-label-text {
    font-size: 15px;
    line-height: 1.5;
}

.limenco-terms-view-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.limenco-terms-view-link:hover {
    text-decoration: underline;
}

.required-mark {
    color: #d32f2f;
    font-weight: bold;
}

/* Widget display styles */
.limenco-terms-navigation {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
}

.limenco-terms-navigation h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
}

.limenco-terms-toc {
    list-style: none;
    margin: 0;
    padding: 0;
}

.limenco-terms-toc li {
    margin: 0;
    padding: 0;
}

.limenco-terms-toc .toc-level-3 {
    padding-left: 25px;
}

.limenco-terms-toc a {
    display: block;
    padding: 8px 12px;
    color: #2563eb;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.limenco-terms-toc a:hover {
    background: #e3f2fd;
}

.limenco-terms-content {
    font-size: 15px;
    line-height: 1.7;
}

/* Responsive */
@media (max-width: 768px) {
    .limenco-terms-popup {
        max-height: 95vh;
        margin: 10px;
    }

    .limenco-terms-popup-header,
    .limenco-terms-popup-content,
    .limenco-terms-popup-footer {
        padding: 15px;
    }

    .limenco-terms-popup-title {
        font-size: 18px;
    }

    .limenco-terms-popup-accept {
        min-width: 200px;
        padding: 10px 30px;
    }
}
