/**
 * CheckToBuild Modal - Optimized for No Scroll
 * Save as: /includes/assets/css/checktobuild.css
 */

/* ========================================
   MODAL BACKDROP
======================================== */

.ctb-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.ctb-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* ========================================
   MODAL CONTENT - COMPACT DESIGN
======================================== */

.ctb-modal-content {
    /* background: #ffffff; */
    margin-right:1rem;
    margin-left:1rem;
    border-radius: 20px;
    backdrop-filter: blur(1px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s 
cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    width: 580px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.ctb-modal.active .ctb-modal-content {
    transform: scale(1) translateY(0);
}



/* ========================================
   MODAL HEADER - COMPACT
======================================== */

.ctb-modal-header {
    position: relative;
    padding: 24px 24px 16px;
    text-align: center;
    border-bottom: 1px solid #E5E7EB;
}

.ctb-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* Modal Logo */
.ctb-modal-logo {
    text-align: left;
    margin-bottom: 16px;
}

.modal-logo-img {
    max-width: 180px;
    height: auto;
    display: inline-block;
}

/* Close Button */
.ctb-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F3F4F6;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6B7280;
    font-size: 20px;
    line-height: 1;
}

.ctb-modal-close:hover {
    background: #E5E7EB;
    color: #111827;
    transform: rotate(90deg);
}

/* ========================================
   MODAL BODY - COMPACT FORM
======================================== */

.ctb-modal-body {
    padding: 20px 24px 24px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 #F3F4F6;
}

.ctb-modal-body::-webkit-scrollbar {
    width: 6px;
}

.ctb-modal-body::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 3px;
}

.ctb-modal-body::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

/* ========================================
   FORM STYLES - COMPACT
======================================== */

.checktobuild-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    position: relative;
    margin-bottom: 0px!important;
    flex: 1;
    min-width: 0;
}

/* Labels */
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

/* Input Fields */
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    background: #FFFFFF;
    transition: all 0.2s ease;
    color: #111827;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #9CA3AF;
    font-size: 13px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Form Row */
.form-row {
    display: flex;
    gap: 12px;
}

/* Help Text */
.form-help {
    display: block;
    font-size: 11px;
    color: #ffffff;
    margin-top: 2px;
}

/* Validation Messages */
.validation-message {
    font-size: 11px;
    margin-top: 2px;
    min-height: 14px;
    transition: all 0.2s ease;
}

.validation-message.error {
    color: #DC2626;
}

.validation-message.success {
    color: #059669;
}

/* ========================================
   SUBMIT BUTTON - COMPACT
======================================== */

.submit-btn {
    width: 100%;
    padding: 12px 20px;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading state */
.checktobuild-form.loading .submit-btn {
    position: relative;
    color: transparent;
}

.checktobuild-form.loading .submit-btn::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   TRUST BADGE
======================================== */

.ctb-modal-trust-badge {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.trust-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.trust-item i {
    color: #10b981;
    font-size: 16px;
    flex-shrink: 0;
}

/* Form Message */
.form-message {
    margin-top: 12px;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    min-height: 0;
}

.form-message[style*="display: none"],
.form-message:empty {
    margin-top: 0;
    padding: 0;
}

.form-message.success {
    background: #F0FDF4;
    color: #059669;
    border: 1px solid #86EFAC;
}

.form-message.error {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FCA5A5;
}

/* ========================================
   RECAPTCHA - BADGE STYLE (Outside Modal)
======================================== */

/* Hide the original reCAPTCHA widget visually but keep it functional */
.recaptcha-form-field {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Custom reCAPTCHA badge - positioned outside modal */
.ctb-recaptcha-badge {
    position: absolute;
    bottom: -40px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

.ctb-recaptcha-badge .recaptcha-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.ctb-recaptcha-badge::before {
    content: '';
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234285F4'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* Responsive - badge below modal on mobile */
@media (max-width: 640px) {
    .ctb-recaptcha-badge {
        bottom: -35px;
        right: 50%;
        transform: translateX(50%);
        padding: 6px 10px;
    }
    
    .ctb-recaptcha-badge .recaptcha-text {
        font-size: 10px;
    }
    
    .ctb-recaptcha-badge::before {
        width: 16px;
        height: 16px;
    }
}

/* ========================================
   RESPONSIVE - MOBILE OPTIMIZED
======================================== */

@media (max-width: 640px) {
    .ctb-modal {
        padding: 10px;
    }
    
    .ctb-modal-content {
        width: 100%;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }
    
    .ctb-modal-header {
        padding: 20px 20px 12px;
    }
    
    .ctb-modal-header h2 {
        font-size: 20px;
    }
    
    .ctb-modal-body {
        padding: 16px 20px 20px;
    }
    
    /* Stack password fields on mobile */
    .form-row {
                     flex-direction: row !important;
        gap: 10px;
    }
    
    .form-group label {
        font-size: 11px;
    }
    
    .form-group input {
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Logo responsive */
    .modal-logo-img {
        max-width: 140px;
    }
    
    /* Trust badge responsive */
    .trust-items {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    
    .trust-item {
        font-size: 12px;
    }
}

/* Very small screens */
@media (max-height: 600px) {
    .ctb-modal-header {
        padding: 16px 20px 12px;
    }
    
    .ctb-modal-header h2 {
        font-size: 20px;
    }
    
    .ctb-modal-body {
        padding: 12px 20px 16px;
    }
    
    .checktobuild-form {
        gap: 8px;
    }
    
    .form-group input {
        padding: 6px 10px;
    }
    
    .submit-btn {
        padding: 10px 16px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .ctb-modal-content {
        max-height: calc(100vh - 20px);
    }
    
    .ctb-modal-header {
        padding: 12px 20px 8px;
    }
    
    .ctb-modal-body {
        padding: 8px 20px 12px;
    }
    
    .form-row {
        /* Keep fields in row on landscape */
        flex-direction: row;
    }
}

/* Body scroll lock */
body.ctb-modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}