/* Custom Popup Styles */
.custom-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.custom-popup-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.custom-popup-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 70%;
    min-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.7);
    transition: transform 0.3s ease-in-out;
}

.custom-popup-overlay.active .custom-popup-container {
    transform: scale(1);
}

.custom-popup-content {
    padding: 30px;
    position: relative;
}

.custom-popup-content h5 {
    margin: 0 0 20px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.custom-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.custom-popup-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Form Styles */
.newsletter-form {
    margin-top: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #12a594;
    box-shadow: 0 0 0 2px rgba(18, 165, 148, 0.1);
}

/* Checkbox Styles */
.checkbox-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background-color: #f9f9f9;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 2px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.checkbox-item:hover {
    background-color: #f0f0f0;
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

.checkbox-item span {
    flex: 1;
    margin-left: 5px;
    line-height: 1.2;
    padding-top: 0;
}

.checkbox-item a {
    color: #12a594;
    text-decoration: none;
}

.checkbox-item a:hover {
    text-decoration: underline;
}

/* Submit Button */
.submit-btn {
    background-color: #12a594;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
}

.submit-btn:hover {
    background-color: #0f8a7a;
}

/* Trigger Button Styles */
.newsletter-popup-trigger {
    background-color: initial;
    text-decoration: underline !important;
    color: white;
    border: none;
    padding: 0px;
    border-radius: 0px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.newsletter-popup-trigger:hover {
    background-color: initial;
    text-decoration: underline !important;
    color: white;
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .newsletter-popup-content {
        max-width: 90%;
        padding: 25px 30px;
        max-height: 80vh;
    }

    .newsletter-topics-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 900px) {
    .newsletter-form-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .newsletter-form-row .newsletter-form-group {
        flex: 1 1 calc(50% - 6px);
        min-width: 200px;
    }

    .newsletter-form-row .newsletter-form-group:last-child {
        flex: 1 1 100%;
    }
}

@media (max-width: 768px) {
    .newsletter-popup-content {
        padding: 25px 20px;
        margin: 15px;
        width: calc(100% - 30px);
        max-width: none;
        max-height: 75vh;
    }

    .newsletter-popup h3 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .newsletter-popup p {
        margin-bottom: 20px;
    }

    .newsletter-topics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .newsletter-topic-item {
        min-width: 150px;
    }

    .newsletter-form-group input[type="text"],
    .newsletter-form-group input[type="email"] {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    /* Stack name fields on mobile */
    .newsletter-form-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .newsletter-form-row .newsletter-form-group {
        flex: 1 1 calc(50% - 6px);
        min-width: 150px;
    }

    .newsletter-form-row .newsletter-form-group:last-child {
        flex: 1 1 100%;
    }
}

@media (max-width: 480px) {
    .newsletter-popup-content {
        padding: 20px 15px;
        margin: 10px;
        width: calc(100% - 20px);
        max-height: 70vh;
    }

    .newsletter-popup h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .newsletter-popup p {
        font-size: 14px;
        margin-bottom: 15px;
    }

    .newsletter-topics-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .newsletter-topic-item {
        min-width: auto;
    }

    .newsletter-topic-item label {
        padding: 6px 8px;
    }

    .newsletter-topic-item .topic-text {
        font-size: 13px;
    }

    .newsletter-form-group {
        gap: 6px;
    }

    .newsletter-form-group input[type="text"],
    .newsletter-form-group input[type="email"] {
        padding: 10px 12px;
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .newsletter-popup-content {
        padding: 15px 10px;
        margin: 5px;
        width: calc(100% - 10px);
        max-height: 65vh;
    }

    .newsletter-popup h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .newsletter-popup p {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .newsletter-topics-grid {
        gap: 6px;
    }

    .newsletter-topic-item .topic-text {
        font-size: 12px;
    }
}

/* Animation for popup appearance */
@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.7);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.custom-popup-overlay.active .custom-popup-container {
    animation: popupFadeIn 0.3s ease-out;
}

/* Newsletter Popup Styles */
.newsletter-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.newsletter-popup.active {
    opacity: 1;
    visibility: visible;
}

.newsletter-popup-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px 40px;
    max-width: 800px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.7);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    cursor: default;
}

.newsletter-popup.active .newsletter-popup-content {
    transform: scale(1);
}

.newsletter-popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.newsletter-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

.newsletter-popup h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

.newsletter-popup p {
    margin: 0 0 25px 0;
    color: #666;
    line-height: 1.6;
    text-align: center;
    font-size: 14px;
}

.newsletter-popup-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.newsletter-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Name fields in same row */
.newsletter-form-row {
    display: flex;
    gap: 15px;
}

.newsletter-form-row .newsletter-form-group {
    flex: 1;
    min-width: 0;
}

.newsletter-form-group label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.newsletter-form-group input[type="text"],
.newsletter-form-group input[type="email"] {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    background: #fff;
}

.newsletter-form-group input[type="text"]:focus,
.newsletter-form-group input[type="email"]:focus {
    outline: none;
    border-color: #12a594;
    box-shadow: 0 0 0 3px rgba(18, 165, 148, 0.1);
}

.newsletter-topics {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: #fafafa;
}

.newsletter-topics-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 15px !important;
    width: 100% !important;
    min-height: 100px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: #fafafa;
}

.newsletter-topics-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 5px;
}

.newsletter-topic-item {
    display: flex;
    align-items: center;
    width: 100%;
}

.newsletter-topic-item label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: normal;
    margin: 0;
    padding: 8px 0;
    width: 100%;
    transition: background-color 0.2s ease;
    border-radius: 6px;
    padding: 8px 12px;
}

.newsletter-topic-item label:hover {
    background-color: rgba(18, 165, 148, 0.05);
}

.newsletter-topic-item input[type="checkbox"] {
    display: none;
}

.newsletter-topic-item .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    background: #fff;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.newsletter-topic-item input[type="checkbox"]:checked+.checkmark {
    background: #12a594;
    border-color: #12a594;
}

.newsletter-topic-item input[type="checkbox"]:checked+.checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.newsletter-topic-item .topic-text {
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

.newsletter-privacy {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 10px;
}

.newsletter-privacy input[type="checkbox"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    accent-color: #12a594;
}

.newsletter-privacy label {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin: 0;
}

.newsletter-privacy a {
    color: #12a594;
    text-decoration: none;
}

.newsletter-privacy a:hover {
    text-decoration: underline;
}

.newsletter-submit-btn {
    background: #12a594;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.newsletter-submit-btn:hover:not(:disabled) {
    background: #0f8a7a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(18, 165, 148, 0.3);
}

.newsletter-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Error and Success Messages */
.newsletter-popup-form .error-message {
    background: #fee;
    color: #c53030;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #c53030;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.4;
}

.newsletter-popup-form .success-message {
    background: #f0fff4;
    color: #2f855a;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #2f855a;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.4;
}

/* Body styles when popup is open */
body.newsletter-popup-open {
    overflow: hidden;
}

/* Loading animation */
.newsletter-submit-btn:disabled::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Language Selector */
.newsletter-language-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
    margin-bottom: 15px;
}

.newsletter-language-select:focus {
    outline: none;
    border-color: #12a594;
    box-shadow: 0 0 0 2px rgba(18, 165, 148, 0.2);
}