/**
 * Lead Magnet Popup Styles
 * Compact no-scroll popup modal
 *
 * @package IslandFreshCleaning
 * @version 1.0.0-beta
 */

/* ============================================
   OVERLAY
   ============================================ */

.lead-magnet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lead-magnet-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ============================================
   MODAL — no scroll, fits viewport
   ============================================ */

.lead-magnet-popup {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 520px;
    position: relative;
    overflow: hidden; /* no scrollbar ever */
    transform: translateY(-30px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    z-index: 100000;
}

.lead-magnet-overlay.active .lead-magnet-popup {
    transform: translateY(0);
    opacity: 1;
}

/* ============================================
   CLOSE BUTTON
   ============================================ */

.popup-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.25);
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
    padding: 0;
    line-height: 1;
}

.popup-close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.popup-close-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ============================================
   HEADER — compact
   ============================================ */

.popup-header {
    background: linear-gradient(135deg, #0077BE 0%, #005a8c 100%);
    color: #fff;
    padding: 28px 24px 20px;
    text-align: center;
    border-radius: 16px 16px 0 0;
    position: relative;
}

.popup-icon {
    font-size: 36px;
    margin-bottom: 8px;
    display: block;
    line-height: 1;
}

.popup-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #fff;
}

.popup-description {
    font-size: 13px;
    opacity: 0.92;
    margin: 0;
    line-height: 1.5;
    color: #fff;
}

/* ============================================
   FORM — tight spacing
   ============================================ */

.lead-magnet-form {
    padding: 20px 24px 16px;
    display: block;
}

.form-group {
    margin-bottom: 12px;
    position: relative;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    font-size: 13px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

/* Restore select dropdown arrow */
.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23666' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Hide textarea to keep modal compact — optional notes removed */
.form-group textarea {
    display: none;
}

/* Hide the textarea label too */
label[for="lead-notes"] {
    display: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #0077BE;
    box-shadow: 0 0 0 3px rgba(0, 119, 190, 0.12);
}

.form-group input.error,
.form-group select.error {
    border-color: #e74c3c;
    background-color: #fff8f8;
}

.form-group input.error:focus,
.form-group select.error:focus {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
}

/* ============================================
   ERROR MESSAGES
   ============================================ */

.form-error {
    display: none;
    color: #e74c3c;
    font-size: 11px;
    margin-top: 3px;
    font-weight: 500;
}

.form-group.error .form-error {
    display: block;
}

/* ============================================
   FORM ROW
   ============================================ */

.form-row {
    display: flex;
    gap: 12px;
}

.form-group.half {
    flex: 1;
    min-width: 0;
}

/* ============================================
   SUBMIT BUTTON
   ============================================ */

.popup-submit-btn {
    width: 100%;
    padding: 13px 24px;
    background: linear-gradient(135deg, #0077BE 0%, #005a8c 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.popup-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 119, 190, 0.35);
}

.popup-submit-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.popup-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.popup-submit-btn:focus-visible {
    outline: 3px solid #0077BE;
    outline-offset: 2px;
}

.popup-submit-btn .btn-loading {
    display: none;
}

.popup-submit-btn.loading .btn-text {
    display: none;
}

.popup-submit-btn.loading .btn-loading {
    display: inline;
}

@keyframes lmSpin {
    to { transform: rotate(360deg); }
}

.popup-submit-btn.loading::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    margin: -9px 0 0 -9px;
    animation: lmSpin 0.7s linear infinite;
}

/* ============================================
   DISCLAIMER
   ============================================ */

.form-disclaimer {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin-top: 10px;
    line-height: 1.4;
}

.form-disclaimer a {
    color: #0077BE;
    text-decoration: none;
}

.form-disclaimer a:hover {
    text-decoration: underline;
}

/* ============================================
   SUCCESS MESSAGE
   ============================================ */

.form-success-message {
    display: none;
    padding: 48px 24px 40px;
    text-align: center;
}

.success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #0077BE 0%, #005a8c 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: bold;
    margin: 0 auto 16px;
    animation: lmPopIn 0.45s ease forwards;
}

@keyframes lmPopIn {
    0%   { transform: scale(0);   opacity: 0; }
    70%  { transform: scale(1.1);             }
    100% { transform: scale(1);   opacity: 1; }
}

.form-success-message h3 {
    font-size: 24px;
    color: #222;
    margin: 0 0 10px;
}

.form-success-message p {
    font-size: 15px;
    color: #666;
    margin: 0 0 24px;
    line-height: 1.6;
}

.success-close-btn {
    padding: 11px 28px;
    background: #0077BE;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
}

.success-close-btn:hover {
    background: #005a8c;
    transform: translateY(-2px);
}

.success-close-btn:focus-visible {
    outline: 3px solid #0077BE;
    outline-offset: 2px;
}

/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */

@media (max-width: 600px) {
    .lead-magnet-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .lead-magnet-popup {
        border-radius: 20px 20px 0 0;
        max-width: 100%;
    }

    .popup-header {
        padding: 20px 18px 14px;
        border-radius: 20px 20px 0 0;
    }

    .popup-icon {
        font-size: 28px;
        margin-bottom: 6px;
    }

    .popup-header h2 {
        font-size: 18px;
    }

    .lead-magnet-form {
        padding: 14px 16px 12px;
    }

    .form-group {
        margin-bottom: 10px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .lead-magnet-overlay,
    .lead-magnet-popup,
    .popup-submit-btn,
    .success-close-btn,
    .popup-close-btn {
        transition: none;
    }
    .success-icon { animation: none; }
    .popup-submit-btn.loading::before { animation: none; }
}

/* ============================================
   PRINT
   ============================================ */

@media print {
    .lead-magnet-overlay { display: none !important; }
}