/* Dark Empires — API / storefront listing page */

body.api-page {
    background: #f9fafb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Slim top-bar header for the api page */
.api-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.api-topbar .brand {
    height: 32px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}
.api-topbar .brand-text {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.15rem;
}

/* Search */
.search-wrap {
    position: relative;
    max-width: 42rem;
    margin: 0 auto 1rem;
}
.search-wrap input {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 2.25rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.search-wrap .fa-search {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.85rem;
}

/* Categories horizontal scroll */
.categories-scroll {
    overflow-x: auto;
    margin-bottom: 1rem;
}
.categories-scroll::-webkit-scrollbar        { height: 4px; }
.categories-scroll::-webkit-scrollbar-track  { background: #e2e8f0; border-radius: 2px; }
.categories-scroll::-webkit-scrollbar-thumb  { background: var(--primary); border-radius: 2px; }
.categories-scroll .cat-row {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    min-width: max-content;
}
.category-btn {
    padding: 0.35rem 0.9rem;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
    font-weight: 500;
    font-size: 0.8rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.category-btn:hover  { border-color: var(--primary); color: var(--primary); }
.category-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Products grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
@media (min-width: 640px)  { .products-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; } }
@media (min-width: 768px)  { .products-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; } }
@media (min-width: 1024px) { .products-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1280px) { .products-grid { grid-template-columns: repeat(5, 1fr); } }

.product-card {
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #f3f4f6;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    display: block;
}
.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }

.product-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background:
        radial-gradient(circle at 30% 20%, rgba(99,102,241,0.25), transparent 60%),
        linear-gradient(135deg, #1e1b4b 0%, #0f172a 55%, #020617 100%);
    padding: 0.5rem;
    overflow: hidden;
}
.product-image-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 70% 90%, rgba(236,72,153,0.12), transparent 55%);
    pointer-events: none;
}
.product-image {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.25rem;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}
.no-image-placeholder {
    position: absolute;
    inset: 0;
    z-index: 1;
    padding: 0.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(
        120deg,
        #312e81 0%,
        #6d28d9 25%,
        #db2777 50%,
        #1e3a8a 75%,
        #312e81 100%
    );
    background-size: 300% 300%;
    animation: de-placeholder-gradient 8s ease-in-out infinite;
}
/* Shimmer sweep */
.no-image-placeholder::before {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        115deg,
        transparent 0%,
        rgba(255,255,255,0.0) 35%,
        rgba(255,255,255,0.18) 50%,
        rgba(255,255,255,0.0) 65%,
        transparent 100%
    );
    transform: skewX(-20deg);
    animation: de-placeholder-shine 3.5s ease-in-out infinite;
    pointer-events: none;
}
/* Soft vignette */
.no-image-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 55%, rgba(0,0,0,0.35) 100%);
    pointer-events: none;
}
.no-image-placeholder span {
    position: relative;
    z-index: 2;
    color: #fff;
    font-weight: 800;
    font-size: 0.78rem;
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-shadow:
        0 1px 2px rgba(0,0,0,0.55),
        0 0 18px rgba(147,197,253,0.45);
    animation: de-placeholder-pulse 2.6s ease-in-out infinite;
}

@keyframes de-placeholder-gradient {
    0%   { background-position:   0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position:   0% 50%; }
}
@keyframes de-placeholder-shine {
    0%   { left: -75%; }
    60%  { left: 125%; }
    100% { left: 125%; }
}
@keyframes de-placeholder-pulse {
    0%, 100% { transform: scale(1);    opacity: 0.95; }
    50%      { transform: scale(1.04); opacity: 1;    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .no-image-placeholder,
    .no-image-placeholder::before,
    .no-image-placeholder span {
        animation: none;
    }
}

.product-info {
    padding: 0.5rem 0.75rem 0.75rem;
}
.product-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.78rem;
    line-height: 1.2;
    margin-bottom: 0.25rem;
    height: 2rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}
.product-prices {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}
.price-original {
    font-size: 0.70rem;
    color: #9ca3af;
    text-decoration: line-through;
    display: block;
}
.price-final {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}
.discount-chip {
    background: #dcfce7;
    color: #166534;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    white-space: nowrap;
}
.product-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.product-rating .stars i {
    color: #facc15;
    font-size: 0.62rem;
}
.product-rating .value {
    font-size: 0.72rem;
    font-weight: 500;
    color: #374151;
}

/* No results */
.no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
}
.no-results i { color: #d1d5db; font-size: 2.5rem; margin-bottom: 0.75rem; }

/* ── Contact popup (glass card modal) ── */
@keyframes contact-pop-in {
    0%   { opacity: 0; transform: translateY(20px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes contact-backdrop-in {
    0%   { opacity: 0; backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); }
    100% { opacity: 1; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
}

.contact-popup {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(99,102,241,0.25), transparent 55%),
        radial-gradient(circle at 80% 80%, rgba(236,72,153,0.22), transparent 55%),
        rgba(2,6,23,0.55);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9990;
    padding: 1rem;
}
.contact-popup.open {
    display: flex;
    animation: contact-backdrop-in 0.3s ease-out;
}

.contact-popup-card {
    position: relative;
    width: 100%;
    max-width: 22rem;
    padding: 1.75rem 1.5rem 1.25rem;
    border-radius: 1.25rem;
    background: linear-gradient(145deg, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0.55) 100%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    backdrop-filter: blur(22px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.45);
    box-shadow:
        0 30px 60px -20px rgba(15,23,42,0.45),
        0 12px 24px -12px rgba(99,102,241,0.30),
        0 0 0 1px rgba(99,102,241,0.08),
        0 1px 0 rgba(255,255,255,0.8) inset;
    animation: contact-pop-in 0.4s cubic-bezier(.2,.9,.3,1) both;
    overflow: hidden;
}
/* Glossy top highlight */
.contact-popup-card::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
}
/* Soft colored glow corner */
.contact-popup-card::after {
    content: '';
    position: absolute;
    top: -40%; right: -40%;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(139,92,246,0.35), transparent 70%);
    pointer-events: none;
    filter: blur(10px);
}

.contact-popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(15,23,42,0.08);
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    font-size: 0.85rem;
    transition: background 0.2s, transform 0.2s, color 0.2s;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 2;
}
.contact-popup-close:hover {
    background: rgba(220,38,38,0.95);
    color: #fff;
    transform: rotate(90deg) scale(1.06);
    border-color: transparent;
}

.contact-popup-title {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 0.35rem;
    text-align: center;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
}
.contact-popup-desc {
    font-size: 0.88rem;
    color: #475569;
    margin: 0 0 1.25rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.contact-popup-btns {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    position: relative;
    z-index: 1;
}
.contact-popup-btn {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.8rem 1rem;
    border-radius: 9999px;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: transform 0.2s, box-shadow 0.25s, filter 0.2s;
    text-decoration: none;
}
.contact-popup-btn i { font-size: 1.1rem; }
.contact-popup-btn:hover  { transform: translateY(-2px); filter: brightness(1.08); }
.contact-popup-btn:active { transform: scale(0.97); }

.contact-popup-btn.whatsapp {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 8px 22px rgba(34,197,94,0.45), 0 1px 0 rgba(255,255,255,0.25) inset;
}
.contact-popup-btn.whatsapp:hover { box-shadow: 0 12px 28px rgba(34,197,94,0.60); }

.contact-popup-btn.telegram {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 8px 22px rgba(59,130,246,0.45), 0 1px 0 rgba(255,255,255,0.25) inset;
}
.contact-popup-btn.telegram:hover { box-shadow: 0 12px 28px rgba(59,130,246,0.60); }

.contact-popup-footer {
    margin-top: 1.2rem;
    padding-top: 0.9rem;
    border-top: 1px dashed rgba(99,102,241,0.18);
    text-align: center;
    position: relative;
    z-index: 1;
}
.contact-popup-footer p {
    font-size: 0.68rem;
    color: #64748b;
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}
.contact-popup-footer img {
    height: 1.6rem;
    margin: 0 auto;
    filter: drop-shadow(0 2px 6px rgba(99,102,241,0.30));
}

@media (prefers-reduced-motion: reduce) {
    .contact-popup.open, .contact-popup-card { animation: none !important; }
}

/* Bottom spacer (so mobile nav doesn't cover last row) */
.api-bottom-space { height: 4rem; }
@media (min-width: 640px) { .api-bottom-space { height: 0; } }

/* Telegram floating button (page-specific override for consistent placement) */
.api-page #telegramButton {
    bottom: 80px;
    right: 12px;
    width: 48px;
    height: 48px;
}
.api-page #telegramButton img { width: 48px; height: 48px; }
