/**
 * Lead Generation System Styles
 * Professional Notion-style modal and banner design
 */

/* ========================================
   Zoom Level Support - Ensure form works at all zoom levels
   ======================================== */

/* Force proper sizing at all zoom levels */
html body .sm-lead-modal,
html body .sm-lead-modal * {
    box-sizing: border-box !important;
}

/* Ensure modal container adapts to viewport at any zoom */
@media screen and (max-height: 800px) {
    .sm-lead-modal-content {
        max-height: 90vh !important;
    }
    
    .sm-lead-modal-body {
        max-height: calc(90vh - 180px) !important;
    }
}

@media screen and (max-height: 600px) {
    .sm-lead-modal-content {
        max-height: 95vh !important;
    }
    
    .sm-lead-modal-body {
        max-height: calc(95vh - 160px) !important;
        padding: 20px !important;
    }
    
    .sm-lead-modal-header {
        padding: 16px 24px !important;
    }
}

@media screen and (max-height: 500px) {
    .sm-lead-modal-body {
        max-height: calc(95vh - 140px) !important;
        padding: 16px !important;
    }
    
    .sm-lead-form-row {
        gap: 12px !important;
    }
}

/* ========================================
   Custom Solution Banner
   ======================================== */

.sm-custom-solution-section {
    margin: 32px 0;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sm-custom-solution-banner {
    background: linear-gradient(135deg, #0f2d40 0%, #1a4a66 100%);
    border-radius: 12px;
    padding: 32px;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    visibility: visible !important;
    opacity: 1 !important;
}

.sm-custom-solution-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.sm-banner-content {
    flex: 1;
    color: #ffffff;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sm-banner-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #ffffff !important;
    line-height: 1.3;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sm-banner-description {
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 20px 0;
    color: rgba(255, 255, 255, 0.9);
}

.sm-banner-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.sm-banner-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.95);
}

.sm-checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 12px;
    flex-shrink: 0;
}

.sm-banner-action {
    flex-shrink: 0;
}

.sm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.sm-btn-primary {
    background: #ffffff;
    color: #0f2d40;
}

.sm-btn-primary:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

/* ========================================
   Modal Styles
   ======================================== */

.sm-lead-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Modal visible state - when display is changed by JS */
.sm-lead-modal[style*="display:flex"],
.sm-lead-modal[style*="display: flex"],
.sm-lead-modal[style*="display:block"],
.sm-lead-modal[style*="display: block"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Modal hidden state - when display:none is set */
.sm-lead-modal[style*="display:none"],
.sm-lead-modal[style*="display: none"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.sm-lead-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Show backdrop when modal is visible */
.sm-lead-modal[style*="display:flex"] ~ .sm-lead-modal-backdrop,
.sm-lead-modal[style*="display: flex"] ~ .sm-lead-modal-backdrop {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Alternative: If backdrop is inside modal container */
.sm-lead-modal[style*="display:flex"] .sm-lead-modal-backdrop,
.sm-lead-modal[style*="display: flex"] .sm-lead-modal-backdrop {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sm-lead-modal-container {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    max-width: 950px !important;
    margin: auto !important;
    max-height: 96vh !important;
    display: flex !important;
    flex-direction: column !important;
}

.sm-lead-modal-content {
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    max-height: 96vh !important;
    height: auto !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Modal Header */
.sm-lead-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.sm-lead-modal-header-content {
    flex: 1;
}

.sm-lead-modal-software-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sm-lead-modal-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
}

.sm-lead-modal-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: #1f2937;
    line-height: 1.3;
}

.sm-lead-modal-subtitle {
    font-size: 14px;
    margin: 0;
    color: #6b7280;
}

.sm-lead-modal-close {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 10;
}

.sm-lead-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* Modal Body */
.sm-lead-modal-body {
    padding: 24px 32px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: 1 !important;
    max-height: calc(96vh - 160px) !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Form Styles */
.sm-lead-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Split Layout */
.sm-lead-form-split {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
}

.sm-lead-form-left {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sm-lead-form-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 20px;
    border-radius: 8px;
    display: block;
}

.sm-lead-form-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 16px 0;
    line-height: 1.4;
}

.sm-lead-request-types {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sm-lead-checkbox-label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #374151 !important;
    padding: 10px 12px !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
}

.sm-lead-checkbox-label:hover {
    background: #f9fafb !important;
    border-color: #2563eb !important;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1) !important;
}

.sm-lead-checkbox-label input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    cursor: pointer !important;
    accent-color: #2563eb !important;
    margin: 0 !important;
}

.sm-lead-checkbox-label input[type="checkbox"]:checked {
    accent-color: #2563eb !important;
}

.sm-lead-checkbox-label span {
    flex: 1;
    font-weight: 500;
    line-height: 1.4;
}

.sm-lead-form-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sm-lead-form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.sm-lead-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sm-lead-form-group-full {
    grid-column: 1 / -1;
}

.sm-lead-form-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sm-required {
    color: #ef4444;
    font-weight: 700;
}

.sm-optional {
    color: #9ca3af;
    font-weight: 400;
    font-size: 13px;
}

.sm-lead-form-control {
    width: 100% !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    transition: all 0.2s ease !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.sm-lead-form-control:hover {
    border-color: #d1d5db !important;
}

.sm-lead-form-control:focus {
    outline: none !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
    background: #ffffff !important;
}

.sm-lead-form-control::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

.sm-lead-form-textarea {
    resize: vertical !important;
    min-height: 70px !important;
    max-height: 120px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

select.sm-lead-form-control {
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="%236b7280" d="M4 6l4 4 4-4z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    padding-right: 40px !important;
}

/* Form Footer */
.sm-lead-form-footer {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 2px;
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
}

/* Form consent section - both checkboxes aligned consistently */
.sm-lead-form-consent {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* All checkbox labels in consent section - FORCE VISIBILITY */
.sm-lead-form-consent-label {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #4b5563 !important;
    user-select: none !important;
    padding: 0 !important;
    margin: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
    border: none !important;
    background: transparent !important;
}

/* All checkboxes and radio buttons in consent section - CRITICAL VISIBILITY */
.sm-lead-form-consent input[type="checkbox"],
.sm-lead-form-consent input[type="radio"],
.sm-lead-radio,
#sm-lead-terms,
#sm-lead-marketing {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer !important;
    opacity: 1 !important;
    visibility: visible !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    position: relative !important;
    vertical-align: top !important;
    z-index: 10 !important;
    accent-color: #2563eb !important;
}

/* Specifically force Terms checkbox to be visible - NATIVE APPEARANCE */
#sm-lead-terms,
input[type="checkbox"]#sm-lead-terms {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    z-index: 10 !important;
    position: relative !important;
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
    appearance: checkbox !important;
    border: 2px solid #d1d5db !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    accent-color: #2563eb !important;
    cursor: pointer !important;
}

#sm-lead-modal input#sm-lead-terms,
#sm-lead-modal .sm-lead-form-consent input#sm-lead-terms {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
}

#sm-lead-terms::before,
#sm-lead-terms::after,
.sm-lead-form-consent-label label[for="sm-lead-terms"]::before,
.sm-lead-form-consent-label label[for="sm-lead-terms"]::after {
    content: none !important;
}

/* Terms checkbox - show rounded corners when checked */
#sm-lead-terms:checked,
input[type="checkbox"]#sm-lead-terms:checked {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

/* Radio button styling - DEPRECATED but kept for compatibility */
.sm-lead-radio,
input[type="radio"].sm-lead-radio {
    border-radius: 50% !important;
}

/* Checkbox styling */
input[type="checkbox"].sm-lead-checkbox {
    border-radius: 4px !important;
}

/* Checked state for both radio and checkbox */
.sm-lead-form-consent input[type="radio"]:checked,
.sm-lead-form-consent input[type="checkbox"]:checked,
#sm-lead-terms:checked,
input[type="radio"].sm-lead-radio:checked,
input[type="checkbox"].sm-lead-checkbox:checked {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

/* Focus state */
.sm-lead-form-consent input[type="radio"]:focus,
.sm-lead-form-consent input[type="checkbox"]:focus,
#sm-lead-terms:focus,
input[type="radio"].sm-lead-radio:focus,
input[type="checkbox"].sm-lead-checkbox:focus {
    outline: 2px solid #2563eb !important;
    outline-offset: 2px !important;
}

/* Checkbox text in consent section */
.sm-lead-form-consent .sm-lead-checkbox-text {
    flex: 1 !important;
    line-height: 1.6 !important;
    display: block !important;
    padding: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0 !important;
    color: #4b5563 !important;
}

/* Checkbox text links */
.sm-lead-form-consent .sm-lead-checkbox-text a {
    color: #2563eb !important;
    text-decoration: none !important;
}

.sm-lead-form-consent .sm-lead-checkbox-text a:hover {
    text-decoration: underline !important;
}

/* Force Native Checkbox Visibility - CRITICAL FIX */
/* Apply to all checkboxes in lead generation forms */
.sm-lead-checkbox,
#sm-lead-modal input[type="checkbox"],
.sm-lead-modal input[type="checkbox"],
.sm-lead-form input[type="checkbox"] {
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
    appearance: checkbox !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    accent-color: #2563eb !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
    line-height: normal !important;
}

/* Specific styling for #sm-lead-terms to show border */
#sm-lead-terms {
    border: 2px solid #d1d5db !important;
    background: #ffffff !important;
}


/* Checked State - Native checkbox remains visible */
.sm-lead-checkbox:checked {
    accent-color: #2563eb;
}

.sm-lead-checkbox:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.sm-lead-checkbox:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Error State - Apply to all lead form checkboxes */
.sm-lead-checkbox.error,
#sm-lead-modal input[type="checkbox"].error,
.sm-lead-modal input[type="checkbox"].error,
.sm-lead-form input[type="checkbox"].error {
    outline: 2px solid #ef4444 !important;
    outline-offset: 2px !important;
}

.sm-lead-checkbox-text {
    flex: 1;
    line-height: 1.5;
    padding-top: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.sm-lead-checkbox-text a {
    color: #2563eb;
    text-decoration: none;
}

.sm-lead-checkbox-text a:hover {
    text-decoration: underline;
}

.sm-lead-form-actions {
    display: flex;
    justify-content: flex-end;
}

.sm-lead-submit-btn {
    background: #2563eb;
    color: #ffffff;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sm-lead-submit-btn:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sm-lead-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sm-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Success/Error Messages */
.sm-lead-success-message,
.sm-lead-error-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    font-size: 15px;
}

.sm-lead-success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.sm-lead-error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.sm-lead-success-message svg,
.sm-lead-error-message svg {
    flex-shrink: 0;
}

.sm-lead-success-message p,
.sm-lead-error-message p {
    margin: 0;
    flex: 1;
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet and below - stack vertically */
@media (max-width: 968px) {
    .sm-lead-form-split {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sm-lead-form-left {
        order: 2;
        padding: 20px;
    }
    
    .sm-lead-form-right {
        order: 1;
    }
    
    .sm-lead-request-types {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .sm-lead-checkbox-label {
        flex: 1;
        min-width: 140px;
    }
}

@media (max-width: 768px) {
    .sm-custom-solution-banner {
        flex-direction: column;
        padding: 24px;
        gap: 24px;
    }

    .sm-banner-title {
        font-size: 24px;
    }

    .sm-banner-description {
        font-size: 15px;
    }
    
    .sm-lead-modal-container {
        max-width: 95vw !important;
        max-height: 90vh !important;
    }
    
    .sm-lead-modal-content {
        max-height: 90vh !important;
    }
    
    .sm-lead-modal-body {
        max-height: calc(90vh - 160px) !important;
    }

    .sm-banner-features {
        grid-template-columns: 1fr;
    }

    .sm-banner-action {
        width: 100%;
    }

    .sm-btn {
        width: 100%;
    }

    .sm-lead-modal {
        padding: 0;
        align-items: flex-end;
    }

    .sm-lead-modal-content {
        border-radius: 12px 12px 0 0;
        max-height: 95vh;
    }

    .sm-lead-modal-header {
        padding: 20px;
    }

    .sm-lead-modal-title {
        font-size: 20px;
    }

    .sm-lead-modal-body {
        padding: 20px;
    }

    .sm-lead-form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .sm-lead-form-actions {
        justify-content: stretch;
    }

    .sm-lead-submit-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .sm-banner-title {
        font-size: 20px;
    }

    .sm-banner-description {
        font-size: 14px;
    }

    .sm-banner-features li {
        font-size: 14px;
    }

    .sm-lead-modal-header {
        padding: 16px;
    }

    .sm-lead-modal-body {
        padding: 16px;
    }

    .sm-lead-modal-title {
        font-size: 18px;
    }

    .sm-lead-form-control {
        padding: 10px 14px;
        font-size: 14px;
    }

    .sm-lead-submit-btn {
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* ========================================
   Accessibility
   ======================================== */

.sm-lead-modal:focus-within {
    outline: none;
}

.sm-lead-form-control:focus-visible,
.sm-lead-checkbox:focus-visible,
.sm-lead-modal-close:focus-visible,
.sm-lead-submit-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .sm-custom-solution-banner,
    .sm-lead-modal {
        display: none !important;
    }
}
