/**
 * FlowNIQ CTA Modal & Form Styles
 *
 * Shared styles for modal dialogs and lead capture forms.
 * Include this CSS file in any landing page that uses the FlowNIQ CTA module.
 *
 * Usage:
 * <link rel="stylesheet" href="/css/flowniq-cta.css">
 */

/* Modal Container */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

/* Modal Content Box */
.modal-content {
    background: white;
    color: #333;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    color: #333;
}

/* Modal Body */
.modal-body {
    padding: 20px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}

.info-tooltip-trigger {
    background: none;
    border: none;
    color: rgba(72, 182, 250, 1);
    cursor: help;
    padding: 0;
    font-size: inherit;
    text-decoration: underline;
}

.info-tooltip-trigger:hover {
    color: rgba(52, 162, 230, 1);
}

.tooltip {
    background: #333;
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    /* Hidden by default */
    display: none;
    /* Prevent layout shift - tooltip overlays content instead of pushing it */
    position: absolute !important;
    left: 0 !important;
    top: calc(100% + 5px) !important;
    width: 100% !important;
    box-sizing: border-box;
    z-index: 100;
}

.tooltip.visible {
    display: block;
}

/* Container for tooltip positioning */
.form-group:has(.tooltip) {
    position: relative;
}

.tooltip a {
    color: rgba(72, 182, 250, 1);
    text-decoration: underline;
}

.tooltip a:hover {
    color: rgba(112, 202, 255, 1);
}

/* Input Fields */
input[type="email"],
input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input[type="email"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: rgba(72, 182, 250, 1);
    box-shadow: 0 0 0 3px rgba(72, 182, 250, 0.1);
}

input[type="email"]:disabled,
input[type="text"]:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    color: #999;
}

input[type="email"][aria-invalid="true"],
input[type="text"][aria-invalid="true"] {
    border-color: #d9534f;
}

/* Error Message */
.error-message {
    color: #d9534f;
    font-size: 14px;
    margin-top: 5px;
}

/* Submit Button */
#submitBtn {
    background: #2b2d42;
    color: white;
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s, opacity 0.2s;
}

#submitBtn:hover:not(:disabled) {
    background: #1f2130;
}

#submitBtn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    margin-top: 20px;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid rgba(72, 182, 250, 1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success View */
.success-message {
    text-align: center;
    padding: 20px;
}

.success-message svg {
    margin-bottom: 20px;
}

.success-message h2 {
    color: rgba(72, 182, 250, 1);
    margin-bottom: 10px;
    font-size: 24px;
}

.success-message p {
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-body {
        padding: 15px;
    }

    .checkbox-label {
        font-size: 13px;
    }
}
