/* Next Download Plugin Frontend Styles */

/* Popup Forms */
.next-download-popup-form {
    display: none;
}

.next-download-popup-form.active {
    display: block;
}

/* Popup Overlay */
.next-download-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Popup Container */
.next-download-popup {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.9);
    animation: popupSlideIn 0.3s ease forwards;
}

@keyframes popupSlideIn {
    to {
        transform: scale(1);
    }
}

/* Popup Header */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.popup-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.next-download-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.next-download-popup-close:hover {
    background-color: #e0e0e0;
    color: #333;
}

/* Popup Content */
.popup-content {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

/* Download Info */
.download-info {
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.download-info p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #555;
}

.download-info p:last-child {
    margin-bottom: 0;
}

.download-info strong {
    color: #333;
}

/* Form Container */
.download-form-container {
    margin-top: 24px;
}

/* Gravity Forms Styling in Popup */
.next-download-popup .gform_wrapper {
    margin: 0;
    display: block !important;
}

.next-download-popup .gform_wrapper .gform_fields {
    margin: 0;
}

.next-download-popup .gform_wrapper .gfield {
    margin-bottom: 16px;
}

.next-download-popup .gform_wrapper .gfield_label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.next-download-popup .gform_wrapper input[type="text"],
.next-download-popup .gform_wrapper input[type="email"],
.next-download-popup .gform_wrapper textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.next-download-popup .gform_wrapper input[type="text"]:focus,
.next-download-popup .gform_wrapper input[type="email"]:focus,
.next-download-popup .gform_wrapper textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Checkbox styling */
.next-download-popup .gform_wrapper .gfield_checkbox {
    margin-top: 16px;
}

.next-download-popup .gform_wrapper .gfield_checkbox .gchoice {
    margin-bottom: 8px;
}

.next-download-popup .gform_wrapper .gfield_checkbox input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.next-download-popup .gform_wrapper .gfield_checkbox .gchoice_label {
    font-size: 14px;
    color: #555;
}

.next-download-popup .gform_wrapper .gfield_checkbox .gchoice_label a {
    color: #0073aa;
    text-decoration: underline;
}

.next-download-popup .gform_wrapper .gfield_checkbox .gchoice_label a:hover {
    color: #005a87;
}

/* Submit Button */
.next-download-popup .gform_wrapper .gform_footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.next-download-popup .gform_wrapper .gform_footer input[type="submit"] {
    background-color: #0073aa;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.next-download-popup .gform_wrapper .gform_footer input[type="submit"]:hover {
    background-color: #005a87;
}

/* Hide hidden fields */
.next-download-popup .gform_wrapper .gfield_visibility_hidden {
    display: none !important;
}

/* Confirmation Message */
.next-download-popup .gform_confirmation_wrapper {
    text-align: center;
    padding: 24px;
}

.next-download-popup .gform_confirmation_message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.next-download-popup .next-download-link {
    display: inline-block;
    background-color: #28a745;
    color: #fff;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.next-download-popup .next-download-link:hover {
    background-color: #218838;
    color: #fff;
}

/* Error Messages */
.next-download-popup .gform_wrapper .validation_error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 4px;
}

.next-download-popup .gform_wrapper .gfield_error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 8px;
}

/* Loading State */
.popup-loading {
    text-align: center;
    padding: 40px;
}

.popup-loading .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .next-download-popup {
        width: 95%;
        margin: 20px;
    }
    
    .popup-header {
        padding: 16px 20px;
    }
    
    .popup-title {
        font-size: 20px;
    }
    
    .popup-content {
        padding: 20px;
    }
    
    .next-download-popup .gform_wrapper input[type="text"],
    .next-download-popup .gform_wrapper input[type="email"],
    .next-download-popup .gform_wrapper textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Prevent body scroll when popup is open */
body.next-download-popup-open {
    overflow: hidden;
}