/**
 * Brochure download modal — matches site / quote modal styling
 */

.brochure-modal {
    position: fixed;
    inset: 0;
    z-index: 100050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.brochure-modal.show {
    display: flex !important;
}

.brochure-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 37, 47, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.brochure-modal-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 2.5rem);
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brochure-modal-content {
    position: relative;
    width: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
    color: #1e293b;
}

.brochure-modal-close {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    z-index: 3;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.brochure-modal-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.brochure-modal-header {
    padding: 1.125rem 3rem 1.125rem 1.5rem;
    background: #0066cc;
    color: #fff;
}

.brochure-modal-header h3 {
    margin: 0 0 0.25rem;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.35;
}

.brochure-modal-header p {
    margin: 0;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.45;
}

.brochure-modal-body {
    padding: 1.5rem;
}

.brochure-intro {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.875rem 1rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #0066cc;
    border-radius: 8px;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #334155;
}

.brochure-intro i {
    color: #0066cc;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.brochure-intro .brochure-product-name {
    color: #0f3f7a;
    font-weight: 700;
}

.brochure-modal .brochure-form,
.brochure-modal .otp-form {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.brochure-modal .form-group {
    display: flex;
    flex-direction: column;
}

.brochure-modal .form-group label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: #1e293b;
    letter-spacing: 0.01em;
}

.brochure-modal .form-group label i {
    color: #64748b;
    font-size: 0.875rem;
    width: 1rem;
    text-align: center;
}

.brochure-modal .form-group label .required {
    color: #dc3545;
    margin-left: 0.1rem;
}

.brochure-modal .form-group input,
.brochure-modal .form-group select {
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.45;
    color: #1e293b;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.brochure-modal .form-group select {
    cursor: pointer;
    appearance: auto;
}

.brochure-modal .form-group input::placeholder {
    color: #94a3b8;
}

.brochure-modal .form-group input:focus,
.brochure-modal .form-group select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.brochure-modal .form-group input.error,
.brochure-modal .form-group select.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.brochure-modal .phone-input-group {
    display: grid;
    grid-template-columns: minmax(9.5rem, 38%) 1fr;
    gap: 0.625rem;
}

.brochure-modal .error-message {
    display: none;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #dc3545;
}

.brochure-modal .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: #0066cc;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.brochure-modal .btn-primary:hover:not(:disabled) {
    background: #0052a3;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.brochure-modal .btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.brochure-modal .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.brochure-modal .btn-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}

.brochure-modal .btn-link {
    border: none;
    background: none;
    padding: 0;
    color: #0066cc;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.brochure-modal .btn-link:hover {
    color: #0052a3;
}

.brochure-modal .btn-link:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* OTP step */
.brochure-modal .modal-state[data-state="otp"] .brochure-intro,
.brochure-modal .modal-state[data-state="loading"] .brochure-intro,
.brochure-modal .modal-state[data-state="success"] .brochure-intro,
.brochure-modal .modal-state[data-state="error"] .brochure-intro {
    display: none;
}

.brochure-modal .otp-input-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 0.5rem 0 0.25rem;
}

.brochure-modal .otp-digit {
    width: 2.75rem !important;
    height: 2.75rem !important;
    padding: 0 !important;
    text-align: center;
    font-size: 1.25rem !important;
    font-weight: 700;
    border-radius: 8px !important;
}

.brochure-modal .otp-resend {
    text-align: center;
    margin-top: 0.5rem;
}

.brochure-modal .otp-resend p {
    margin: 0 0 0.35rem;
    font-size: 0.875rem;
    color: #64748b;
}

/* Status states */
.brochure-modal .modal-state[data-state="loading"] .brochure-modal-body,
.brochure-modal .modal-state[data-state="success"] .brochure-modal-body,
.brochure-modal .modal-state[data-state="error"] .brochure-modal-body {
    text-align: center;
    padding-top: 1rem;
}

.brochure-modal .loading-spinner {
    font-size: 2.5rem;
    color: #0066cc;
    margin-bottom: 1rem;
}

.brochure-modal .success-icon {
    font-size: 3rem;
    color: #16a34a;
    margin-bottom: 1rem;
}

.brochure-modal .error-icon {
    font-size: 3rem;
    color: #dc3545;
    margin-bottom: 1rem;
}

.brochure-modal .modal-state[data-state="loading"] .brochure-modal-header h3,
.brochure-modal .modal-state[data-state="success"] .brochure-modal-header h3,
.brochure-modal .modal-state[data-state="error"] .brochure-modal-header h3 {
    text-transform: none;
    letter-spacing: -0.01em;
    font-size: 1.25rem;
}

.brochure-modal .error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.25rem;
}

.brochure-modal .btn-loading {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

@keyframes brochure-modal-spin {
    to { transform: rotate(360deg); }
}

.brochure-modal .btn-loading i,
.brochure-modal .loading-spinner i {
    animation: brochure-modal-spin 1s linear infinite;
}

@media (max-width: 767.98px) {
    .brochure-modal {
        padding: 0.75rem;
        align-items: flex-start;
    }

    .brochure-modal-container {
        max-height: none;
        margin-top: 0.5rem;
    }

    .brochure-modal-body {
        padding: 1.25rem;
    }

    .brochure-modal .phone-input-group {
        grid-template-columns: 1fr;
    }

    .brochure-modal .otp-digit {
        width: 2.35rem !important;
        height: 2.35rem !important;
        font-size: 1.1rem !important;
    }

    .brochure-modal .error-actions {
        flex-direction: column;
    }

    .brochure-modal .error-actions .btn-primary,
    .brochure-modal .error-actions .btn-secondary {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .brochure-modal .btn-primary,
    .brochure-modal .btn-secondary,
    .brochure-modal-close,
    .brochure-modal .form-group input,
    .brochure-modal .form-group select {
        transition: none;
    }

    .brochure-modal .btn-loading i,
    .brochure-modal .loading-spinner i {
        animation: none;
    }
}

body.brochure-modal-open {
    overflow: hidden;
}

/* Beat legacy global rules bundled in app.css */
.brochure-modal:not(.show) {
    display: none !important;
}

.brochure-modal.show {
    display: flex !important;
    z-index: 100050 !important;
}

.brochure-modal .brochure-modal-content {
    padding: 0 !important;
    background: #fff !important;
    color: #1e293b !important;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08) !important;
}

.brochure-modal .brochure-modal-close {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
}

.brochure-modal .brochure-modal-close:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    color: #fff !important;
}

.brochure-modal .form-group input,
.brochure-modal .form-group select {
    background: #fff !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
}

.brochure-modal .iti {
    width: 100%;
    display: block;
}

.brochure-modal.brochure-country-open .form-group:has(#brochurePhone) {
    position: relative;
    z-index: 30;
}

body .iti--container.brochure-iti-dropdown {
    z-index: 100200 !important;
    pointer-events: auto !important;
}

body .iti--container.brochure-iti-dropdown .iti__dropdown-content,
body .iti--container.brochure-iti-dropdown .iti__search-input,
body .iti--container.brochure-iti-dropdown .iti__country-list,
body .iti--container.brochure-iti-dropdown .iti__country {
    pointer-events: auto !important;
}

body .iti--container.brochure-iti-dropdown .iti__dropdown-content {
    background: #fff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
    max-height: min(280px, 52vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body .iti--container.brochure-iti-dropdown .iti__search-input {
    color: #1e293b;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

body .iti--container.brochure-iti-dropdown .iti__country-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 220px !important;
    overflow-y: scroll !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

body .iti--container.brochure-iti-dropdown .iti__country {
    color: #1e293b;
}

body .iti--container.brochure-iti-dropdown .iti__country.iti__highlight {
    background: #f1f5f9;
}

body.brochure-country-dropdown-open {
    overflow: hidden !important;
}

body.brochure-country-dropdown-open #smooth-wrapper,
body.brochure-country-dropdown-open #smooth-content {
    overflow: hidden !important;
    touch-action: none;
}

.brochure-quick-download-toast {
    position: fixed;
    right: 1rem;
    bottom: 1.25rem;
    z-index: 100300;
    max-width: min(360px, calc(100vw - 2rem));
    padding: 0.875rem 1rem;
    border-radius: 10px;
    background: #065f46;
    color: #ecfdf5;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    font-size: 0.9375rem;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.brochure-quick-download-toast.show {
    opacity: 1;
    transform: translateY(0);
}
