.download-gate-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.download-gate-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.download-gate-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.download-gate-modal__container {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

.download-gate-modal[aria-hidden="false"] .download-gate-modal__container {
    transform: translateY(0) scale(1);
}

.download-gate-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 0;
}

.download-gate-modal__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
}

.download-gate-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #666;
    transition: background 0.2s ease, color 0.2s ease;
}

.download-gate-modal__close:hover {
    background: #f0f0f0;
    color: #1a1a1a;
}

.download-gate-modal__close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.download-gate-modal__body {
    padding: 1rem 1.5rem 1.5rem;
}

.download-gate-modal__description {
    margin: 0 0 1.5rem;
    font-size: 0.9375rem;
    color: #666;
    line-height: 1.5;
}

.download-gate-modal__form-container {
    min-height: 200px;
}

.download-gate-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: #666;
    font-size: 0.875rem;
}

.download-gate-modal__loading[aria-hidden="true"] {
    display: none;
}

.download-gate-modal__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e5e5;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: download-gate-spin 0.8s linear infinite;
}

@keyframes download-gate-spin {
    to {
        transform: rotate(360deg);
    }
}

.download-gate-modal__error {
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 0.875rem;
    text-align: center;
}

.download-gate-modal__error[aria-hidden="true"] {
    display: none;
}

.download-gate-modal__fallback-link {
    color: #2563eb;
    text-decoration: underline;
}

.download-gate-modal .hs-form {
    max-width: 100%;
}

.download-gate-modal .hs-form-field {
    margin-bottom: 1rem;
}

.download-gate-modal .hs-form-field label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.download-gate-modal .hs-form-field label .hs-form-required {
    color: #dc2626;
    margin-left: 0.25rem;
}

.download-gate-modal .hs-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.download-gate-modal .hs-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.download-gate-modal .hs-input.error {
    border-color: #dc2626;
}

.download-gate-modal .hs-error-msgs {
    margin: 0.375rem 0 0;
    padding: 0;
    list-style: none;
}

.download-gate-modal .hs-error-msg {
    font-size: 0.8125rem;
    color: #dc2626;
}

.download-gate-modal .hs-submit {
    margin-top: 1.25rem;
}

.download-gate-modal .hs-button {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: #2563eb;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.download-gate-modal .hs-button:hover {
    background: #1d4ed8;
}

.download-gate-modal .hs-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.download-gate-modal .legal-consent-container {
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.download-gate-modal .legal-consent-container a {
    color: #2563eb;
}

@media (max-width: 480px) {
    .download-gate-modal {
        padding: 0;
        align-items: flex-end;
    }

    .download-gate-modal__container {
        max-width: 100%;
        max-height: 85vh;
        border-radius: 12px 12px 0 0;
        transform: translateY(100%);
    }

    .download-gate-modal[aria-hidden="false"] .download-gate-modal__container {
        transform: translateY(0);
    }
}
