/* =====================================================
   Horse Access Modal — Dom Cavalo
   Restricted horse access request + unlock flow
   ===================================================== */

/* Modal shell */
.horse-access-modal {
    position: fixed; inset: 0; z-index: 9999;
    display: none; align-items: flex-start; justify-content: center;
    padding: 40px 20px; overflow-y: auto;
}
.horse-access-modal.is-open { display: flex; }

.horse-access-modal__overlay {
    position: fixed; inset: 0;
    background: rgba(20, 16, 12, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    animation: haFadeIn .24s ease-out forwards;
}
.horse-access-modal.is-closing .horse-access-modal__overlay {
    animation: haFadeOut .2s ease-in forwards;
}

.horse-access-modal__dialog {
    position: relative; width: 100%; max-width: 500px;
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    margin: auto 0;
    opacity: 0; transform: scale(0.96) translateY(8px);
    animation: haDialogIn .28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: .04s;
}
.horse-access-modal.is-closing .horse-access-modal__dialog {
    animation: haDialogOut .18s ease-in forwards;
    animation-delay: 0s;
}

.horse-access-modal__top {
    height: 6px; background: var(--accent-color, #c9a96e);
}

.horse-access-modal__close {
    position: absolute; top: 20px; right: 20px;
    width: 36px; height: 36px; border: none;
    background: rgba(66, 58, 52, 0.06); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--primary-color, #3b3028);
    transition: all .3s ease-out; z-index: 2;
}
.horse-access-modal__close:hover {
    background: var(--accent-color, #c9a96e);
    transform: rotate(90deg);
}

.horse-access-modal__body { padding: 44px 40px 36px; }

.horse-access-modal__eyebrow {
    color: #9a8c7a; font-size: 0.72rem; font-weight: 700;
    letter-spacing: 3px; text-transform: uppercase; margin: 0 0 10px;
}

.horse-access-modal__title {
    font-family: var(--default-font, serif);
    color: var(--primary-color, #3b3028);
    font-size: 1.6rem; font-weight: 600; line-height: 1.2;
    margin: 0 0 10px;
}
.horse-access-modal__title span {
    font-family: 'Playfair Display', serif;
    color: var(--accent-color, #c9a96e);
    font-style: italic;
}

.horse-access-modal__lead {
    color: #6e6358; font-size: 0.9rem; line-height: 1.5;
    margin: 0 0 24px;
}

/* Panels — animated transitions between states */
.horse-access-modal__panel[hidden] { display: none; }
.horse-access-modal__panel {
    animation: haPanelIn .24s ease-out;
}

/* Honeypot — invisible, inaccessible to normal users */
.ha-honeypot {
    position: absolute; left: -9999px;
    width: 1px; height: 1px; overflow: hidden;
}

/* Form fields */
.ha-field { margin-bottom: 16px; }
.ha-field__label {
    display: block; color: var(--primary-color, #3b3028);
    font-size: 0.78rem; font-weight: 600; letter-spacing: 1.2px;
    text-transform: uppercase; margin-bottom: 6px;
}
.ha-field__opt {
    color: #9a8c7a; font-weight: 500;
    letter-spacing: 0.5px; text-transform: none;
}
.ha-field__input {
    width: 100%; padding: 12px 16px;
    border: 1px solid #e5dfd4; border-radius: 8px;
    font-family: var(--default-font, inherit); font-size: 0.92rem;
    color: var(--primary-color, #3b3028); background: #faf8f4;
    outline: none; transition: all .25s ease-out;
}
.ha-field__input:focus {
    border-color: var(--accent-color, #c9a96e);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(201, 169, 110, 0.12);
}
.ha-field__input--textarea { resize: vertical; min-height: 80px; }
.ha-field__input--code {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem; letter-spacing: 4px; text-align: center;
}
.ha-field__error {
    color: #c84a4a; font-size: 0.78rem; margin: 6px 0 0;
    display: none;
}
.ha-field.has-error .ha-field__input { border-color: #c84a4a; }
.ha-field.has-error .ha-field__error { display: block; }

/* Buttons */
.ha-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; padding: 14px 24px; border: none; border-radius: 8px;
    font-family: var(--default-font, inherit); font-size: 0.9rem;
    font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
    cursor: pointer; transition: all .25s ease-out;
    margin-top: 8px;
}
.ha-btn--primary {
    background: var(--accent-color, #c9a96e);
    color: var(--primary-color, #3b3028);
}
.ha-btn--primary:hover {
    background: var(--primary-color, #3b3028);
    color: #fff;
    transform: translateY(-1px);
}
.ha-btn[disabled] {
    opacity: 0.6; cursor: not-allowed; transform: none;
}
.ha-btn.is-loading { pointer-events: none; opacity: 0.7; }

.ha-link {
    display: block; width: 100%; text-align: center;
    background: none; border: 0; padding: 14px 0 0;
    color: #6e6358; font-size: 0.85rem;
    cursor: pointer; text-decoration: underline;
    transition: color .2s ease-out;
}
.ha-link:hover { color: var(--accent-color, #c9a96e); }

/* Success panel */
.ha-success { text-align: center; padding: 8px 0; }
.ha-success__icon {
    width: 72px; height: 72px; margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(201, 169, 110, 0.18);
    color: var(--accent-color, #c9a96e);
    display: flex; align-items: center; justify-content: center;
    animation: haSuccessIn .4s cubic-bezier(0.16, 1, 0.3, 1);
}
.ha-success h3 {
    font-family: var(--default-font, inherit);
    color: var(--primary-color, #3b3028);
    font-size: 1.3rem; font-weight: 600; margin: 0 0 10px;
}
.ha-success h3 em {
    font-family: 'Playfair Display', serif;
    color: var(--accent-color, #c9a96e);
    font-style: italic;
}
.ha-success p {
    color: #6e6358; font-size: 0.88rem; line-height: 1.5;
    margin: 0 0 8px;
}

/* Inline alert (generic error/info messages) */
.ha-alert {
    padding: 10px 14px; border-radius: 8px;
    font-size: 0.85rem; margin: 0 0 16px;
}
.ha-alert--error {
    background: rgba(200, 74, 74, 0.08);
    color: #b03e3e;
    border: 1px solid rgba(200, 74, 74, 0.2);
}

/* Card state for restricted horses */
.shop-card--restricted .shop-card-badge--lock {
    background: #b26a1a;
    color: #fff;
}

/* Keyframes */
@keyframes haFadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes haFadeOut  { from { opacity: 1; } to { opacity: 0; } }
@keyframes haDialogIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes haDialogOut {
    from { opacity: 1; transform: scale(1) translateY(0); }
    to   { opacity: 0; transform: scale(0.98) translateY(4px); }
}
@keyframes haPanelIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes haSuccessIn {
    0%   { opacity: 0; transform: scale(0.6); }
    60%  { opacity: 1; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

@media (max-width: 480px) {
    .horse-access-modal { padding: 20px 12px; }
    .horse-access-modal__body { padding: 36px 24px 28px; }
    .horse-access-modal__title { font-size: 1.3rem; }
}
