/* ========================================
   MODAL STYLES
   ======================================== */

/* Disable built-in popups/modals from plugins */
body > .hf-modal,
body > .hf-popup,
body > [class*="html-forms-modal"],
body > [class*="html-forms-popup"],
body > [id*="popup"],
body > [id*="modal"]:not(#contact-form-modal) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Block overlays from other plugins */
body > [class*="overlay"]:not(.modal-overlay),
body > [class*="backdrop"]:not(.modal-overlay) {
    display: none !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.3s, transform 0.2s;
    z-index: 2;
}

.modal-close:hover {
    color: #000;
    transform: rotate(90deg);
}

.modal-header {
    padding: 30px 30px 10px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 22.4px;
    font-weight: 600;
    color: #1a1a1a;
}

.modal-body h2 {
    margin: 0 0 20px 0;
    font-size: 22.4px;
    font-weight: 600;
    color: #1a1a1a;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 0 1 auto;
}

/* Form styles inside modal */
.modal-body form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Field groups */
.modal-body form > p,
.modal-body form > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}

/* Label */
.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-main, #1f2937);
    letter-spacing: 0.3px;
}

/* Input fields */
.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="tel"],
.modal-body input[type="url"],
.modal-body input[type="number"],
.modal-body textarea,
.modal-body select {
    width: 100%;
    padding: 11.2px 12.8px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md, 8px);
    font-size: 12.8px;
    font-family: inherit;
    color: var(--color-text-main, #1f2937);
    background: #ffffff;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.modal-body input[type="text"]:focus,
.modal-body input[type="email"]:focus,
.modal-body input[type="tel"]:focus,
.modal-body input[type="url"]:focus,
.modal-body input[type="number"]:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    outline: none;
    border-color: var(--color-primary, #3B69FE);
    box-shadow: 0 0 0 3px rgba(59, 105, 254, 0.1);
}

.modal-body input::placeholder,
.modal-body textarea::placeholder {
    color: var(--color-text-muted, #6b7280);
}

/* Textarea */
.modal-body textarea {
    min-height: 120px;
    resize: vertical;
}

/* Submit button */
.modal-body button[type="submit"],
.modal-body input[type="submit"] {
    display: inline-block;
    padding: 14px 32px;
    background: var(--color-primary, #3B69FE);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md, 8px);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
    text-transform: none;
    letter-spacing: 0.3px;
}

.modal-body button[type="submit"]:hover,
.modal-body input[type="submit"]:hover {
    background: var(--color-primary-hover, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 105, 254, 0.3);
}

.modal-body button[type="submit"]:active,
.modal-body input[type="submit"]:active {
    transform: translateY(0);
}

/* Required indicator */
.modal-body label.required::after {
    content: ' *';
    color: #ef4444;
    font-weight: 700;
}

/* Checkbox & Radio */
.modal-body input[type="checkbox"],
.modal-body input[type="radio"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

.modal-body input[type="checkbox"] + label,
.modal-body input[type="radio"] + label {
    display: inline;
    margin-left: 4px;
    cursor: pointer;
    font-weight: 400;
}

/* Error states */
.modal-body input.hf-invalid,
.modal-body textarea.hf-invalid,
.modal-body select.hf-invalid {
    border-color: #ef4444;
}

.modal-body input.hf-invalid:focus,
.modal-body textarea.hf-invalid:focus,
.modal-body select.hf-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Field errors */
.modal-body .hf-field-error {
    color: #ef4444;
    font-size: 14px;
    margin-top: 6px;
    display: block;
}

.modal-body .hf-message {
    display: none !important;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 320px;
    max-width: 500px;
    padding: 18px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.toast-notification.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
}

.toast-notification.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
}

.toast-notification.toast-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
}

.toast-notification .toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.toast-notification .toast-message {
    flex: 1;
    line-height: 1.5;
}

.toast-notification .toast-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toast-notification .toast-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Loading state */
.modal-body form.hf-loading {
    opacity: 0.6;
    pointer-events: none;
}

.modal-body form.hf-loading button[type="submit"]::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 10px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Help text */
.modal-body .hf-field-description {
    font-size: 13px;
    color: var(--color-text-muted, #6b7280);
    margin-top: 4px;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .toast-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
        padding: 16px 20px;
        font-size: 14px;
    }

    .toast-notification .toast-icon {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }

    .toast-notification .toast-close {
        width: 22px;
        height: 22px;
        font-size: 16px;
    }

    .modal.is-open {
        align-items: flex-start;
        padding-top: 20px;
    }

    .modal-content {
        max-width: 95%;
        height: 100svh;
        border-radius: 8px;
    }

    .modal-header {
        padding: 20px 20px 15px;
    }

    .modal-header h3 {
        font-size: 22px;
        padding-right: 30px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-close {
        top: 15px;
        right: 15px;
        padding: 6px;
    }
}

@media (max-width: 480px) {
    .modal.is-open {
        align-items: flex-start;
        padding-top: 0;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        min-height: 100svh;
        border-radius: 0;
        margin: 0;
        top: 20px;
    }

    .modal-header {
        padding: 20px 20px 15px;
    }

    .modal-header h3 {
        font-size: 20px;
    }

    .modal-body {
        padding: 15px;
    }
    
    .modal-body h2 {
        font-size: 18px;
    }

    .modal-body input[type="text"],
    .modal-body input[type="email"],
    .modal-body input[type="tel"],
    .modal-body textarea {
        font-size: 14px;
        padding: 10px 12px;
    }
}

