/**
 * Terms & Conditions Modal
 * Professional bank-grade styling - clean, minimal, trustworthy
 */

/* ─── Overlay ─────────────────────────────────────────────── */
.terms-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.terms-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ─── Modal Container ─────────────────────────────────────── */
.terms-modal {
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.terms-overlay.active .terms-modal {
    transform: translateY(0) scale(1);
}

/* ─── Header ──────────────────────────────────────────────── */
.terms-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.terms-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #f0f4ff;
    border-radius: 12px;
    margin-bottom: 16px;
}

.terms-header-icon svg {
    width: 24px;
    height: 24px;
    color: #4361ee;
}

.terms-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 4px;
    line-height: 1.3;
}

.terms-header p {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* ─── Content Area ────────────────────────────────────────── */
.terms-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    font-size: 0.875rem;
    line-height: 1.7;
    color: #374151;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.terms-content::-webkit-scrollbar {
    width: 6px;
}

.terms-content::-webkit-scrollbar-track {
    background: transparent;
}

.terms-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.terms-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Content Typography */
.terms-content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 20px 0 8px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

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

.terms-content p {
    margin: 0 0 12px;
    text-align: justify;
}

.terms-content ul {
    margin: 8px 0 12px;
    padding-left: 20px;
}

.terms-content ul li {
    margin-bottom: 6px;
    position: relative;
}

.terms-content .terms-version {
    display: inline-block;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.terms-content .terms-effective-date {
    color: #6b7280;
    font-size: 0.8rem;
    font-style: italic;
    margin-bottom: 16px;
}

/* ─── Footer (Checkbox + Button) ──────────────────────────── */
.terms-footer {
    padding: 20px 28px;
    border-top: 1px solid #e8e8e8;
    background: #fafafa;
    flex-shrink: 0;
}

.terms-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.terms-checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.terms-checkmark {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-top: 1px;
    background: #fff;
}

.terms-checkbox-wrapper input[type="checkbox"]:checked + .terms-checkmark {
    background: #4361ee;
    border-color: #4361ee;
}

.terms-checkmark svg {
    width: 14px;
    height: 14px;
    color: #fff;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.terms-checkbox-wrapper input[type="checkbox"]:checked + .terms-checkmark svg {
    opacity: 1;
    transform: scale(1);
}

.terms-checkbox-label {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #374151;
}

.terms-accept-btn {
    width: 100%;
    padding: 14px;
    background: #4361ee;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.terms-accept-btn:hover:not(:disabled) {
    background: #3651d4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.terms-accept-btn:active:not(:disabled) {
    transform: translateY(0);
}

.terms-accept-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.terms-accept-btn .btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: terms-spin 0.7s linear infinite;
}

@keyframes terms-spin {
    to { transform: rotate(360deg); }
}

/* ─── Scroll Indicator ────────────────────────────────────── */
.terms-scroll-hint {
    text-align: center;
    padding: 8px;
    color: #9ca3af;
    font-size: 0.75rem;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.3s ease;
}

.terms-scroll-hint.hidden {
    display: none;
}

.terms-scroll-hint svg {
    width: 14px;
    height: 14px;
    animation: terms-bounce 1.5s ease infinite;
}

@keyframes terms-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
    .terms-overlay {
        padding: 8px;
        align-items: flex-end;
    }

    .terms-modal {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        max-width: 100%;
    }

    .terms-header,
    .terms-content,
    .terms-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .terms-header h2 {
        font-size: 1.1rem;
    }

    .terms-content {
        font-size: 0.82rem;
    }
}

/* ─── Block page interaction when modal is active ─────────── */
body.terms-modal-active {
    overflow: hidden;
}

body.terms-modal-active .sidebar,
body.terms-modal-active .main-content,
body.terms-modal-active .top-nav {
    pointer-events: none;
    filter: blur(2px);
}
