/* Products modal + products page styles
   Loaded globally via includes/header.css (@import)
   Uses existing design tokens/variables; no new theme colors. */

.products-modal[hidden] {
    display: none;
}

.products-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

body.no-scroll {
    overflow: hidden;
}

.products-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(10px) saturate(150%);
}

.products-modal__dialog {
    position: relative;
    width: min(1120px, calc(100vw - 2.5rem));
    max-height: min(86vh, 820px);
    overflow: auto;

    scrollbar-width: thin;
    scrollbar-color: rgba(0, 217, 138, 0.45) rgba(0, 0, 0, 0.18);

    background: linear-gradient(135deg, rgba(22, 29, 37, 0.97), rgba(15, 20, 25, 0.97));
    border: 1px solid rgba(0, 217, 138, 0.18);
    border-radius: 18px;
    box-shadow:
        0 30px 100px rgba(0, 0, 0, 0.85),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Auth modal (login) – reuses products modal shell */
.auth-modal .products-modal__dialog {
    width: min(560px, calc(100vw - 2.5rem));
    max-height: min(86vh, 720px);
}

.auth-modal__form {
    display: grid;
    gap: 0.9rem;
}

.auth-modal__status {
    min-height: 1.1em;
    color: var(--text-secondary);
    font-weight: 700;
}

.auth-modal__status[data-variant="error"] {
    color: var(--text-secondary);
    opacity: 0.95;
}

.auth-modal__field {
    display: grid;
    gap: 0.35rem;
}

.auth-modal__label {
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.auth-modal__input {
    height: 46px;
    border-radius: 12px;
    padding: 0 0.95rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--text-primary);
    outline: none;
}

.auth-modal__input:focus {
    border-color: rgba(0, 217, 138, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 217, 138, 0.14);
}

.auth-modal__actions {
    margin-top: 0.2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}

.products-modal__dialog::-webkit-scrollbar {
    width: 10px;
}

.products-modal__dialog::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 999px;
}

.products-modal__dialog::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 138, 0.35);
    border-radius: 999px;
    border: 2px solid rgba(0, 0, 0, 0.18);
}

.products-modal__dialog::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 138, 0.48);
}

.products-modal__header {
    padding: 1.25rem 1.25rem 0.9rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.products-modal__kicker {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.products-modal__title {
    margin-top: 0.35rem;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
}

.products-modal__subtitle {
    margin-top: 0.35rem;
    color: var(--text-secondary);
    max-width: 70ch;
}

.products-modal__close {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.products-modal__close:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 217, 138, 0.35);
}

.products-modal__close:focus-visible {
    outline: 2px solid rgba(0, 217, 138, 0.55);
    outline-offset: 3px;
}

.products-modal__content {
    padding: 1.1rem 1.25rem 1.25rem;
}

.products-modal__status {
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 0.75rem;
    min-height: 1.1em;
    display: grid;
    gap: 0.45rem;
}

.products-modal__loader {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.10);
    overflow: hidden;
    display: none;
}

.products-modal__loader::after {
    content: "";
    display: block;
    height: 100%;
    width: 40%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(0, 217, 138, 0.0), rgba(0, 217, 138, 0.55), rgba(0, 217, 138, 0.0));
    transform: translateX(-60%);
    animation: productsLoaderSlide 1.0s ease-in-out infinite;
}

.products-modal__loader.is-visible {
    display: block;
}

.products-modal__statusText {
    min-height: 1.1em;
}

@keyframes productsLoaderSlide {
    0% { transform: translateX(-60%); }
    100% { transform: translateX(260%); }
}

.products-modal__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.products-card {
    position: relative;
    background:
        radial-gradient(120% 140% at 18% 0%, rgba(0, 217, 138, 0.10), transparent 55%),
        rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 16px;
    padding: 1.15rem;
    display: grid;
    grid-template-rows: auto auto auto 1fr;
    gap: 0.6rem;
    min-height: 236px;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.products-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    opacity: 0.9;
}

.products-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 217, 138, 0.22);
    background:
        radial-gradient(120% 140% at 18% 0%, rgba(0, 217, 138, 0.14), transparent 55%),
        rgba(255, 255, 255, 0.05);
}

.products-card:focus-within {
    border-color: rgba(0, 217, 138, 0.35);
}

.products-card__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    padding: 0.32rem 0.6rem;
    border-radius: 999px;
    background: rgba(0, 217, 138, 0.10);
    border: 1px solid rgba(0, 217, 138, 0.20);
    color: var(--accent-green);
    font-weight: 800;
    font-size: 0.85rem;
}

.products-card__title {
    font-size: 1.2rem;
    font-weight: 950;
    letter-spacing: -0.01em;
    line-height: 1.15;
}

.products-card__desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.products-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.products-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.20);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.82rem;
}

.products-card__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    margin-top: auto;
}

.products-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.products-btn--primary {
    background: var(--accent-green);
    color: var(--primary-bg);
    box-shadow: 0 12px 26px rgba(0, 217, 138, 0.18);
}

.products-btn--ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.10);
    color: var(--text-primary);
}

.products-btn:hover {
    transform: translateY(-1px);
}

.products-btn--primary:hover {
    box-shadow: 0 16px 34px rgba(0, 217, 138, 0.26);
}

.products-btn--ghost:hover {
    border-color: rgba(0, 217, 138, 0.35);
}

.products-btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

.products-btn[aria-disabled="true"]:hover {
    transform: none;
    box-shadow: none;
}

.products-btn:focus-visible,
.products-link:focus-visible {
    outline: 2px solid rgba(0, 217, 138, 0.55);
    outline-offset: 3px;
}

.products-card__subactions {
    margin-top: 0.15rem;
}

.products-link {
    color: var(--accent-green);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.92rem;
}

.products-link:hover {
    text-decoration: underline;
}

.products-modal__footer {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.products-modal__updated {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.92rem;
}

@media (max-width: 980px) {
    .products-modal__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .products-modal {
        padding: 0.85rem;
    }

    .products-modal__dialog {
        width: calc(100vw - 1.7rem);
        max-height: 88vh;
    }

    .products-modal__header {
        padding: 1.1rem 1.05rem 0.85rem;
    }

    .products-modal__content {
        padding: 1rem 1.05rem 1.1rem;
    }

    .products-modal__grid {
        grid-template-columns: 1fr;
    }

    .products-card__actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .products-btn,
    .products-modal__close,
    .products-card {
        transition: none;
    }

    .products-modal__loader::after {
        animation: none;
        transform: translateX(0);
        width: 100%;
        background: rgba(0, 217, 138, 0.30);
    }
}
