/* =============================================================================
   Tenebris Store - Səbət (Cart) qlobal stilləri
   Toast bildirişləri, header səbət düyməsi, badge-lər və "Səbətə əlavə et"
   düymələri. Bu fayl bütün səhifələrə header vasitəsilə qoşulur.
   ============================================================================= */

:root {
    --tc-violet: #8b5cf6;
    --tc-violet-l: #a78bfa;
    --tc-pink: #ec4899;
    --tc-green: #10b981;
    --tc-red: #ef4444;
    --tc-amber: #f59e0b;
}

/* -----------------------------------------------------------------------------
   TOAST
   -------------------------------------------------------------------------- */
.tc-toast-wrap {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 32px);
}

.tc-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px 13px 15px;
    border-radius: 999px;
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background: rgba(19, 19, 28, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 22px 48px -20px rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    transform: translateY(18px) scale(0.96);
    transition: opacity .28s ease, transform .34s cubic-bezier(.2, .8, .2, 1);
    pointer-events: auto;
    max-width: 100%;
}

.tc-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.tc-toast-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

.tc-toast-text { min-width: 0; }

.tc-toast-link {
    color: #fff;
    text-decoration: underline;
    font-weight: 700;
    white-space: nowrap;
}

.tc-toast.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.96), rgba(5, 150, 105, 0.96));
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 22px 48px -20px rgba(16, 185, 129, 0.75);
}

.tc-toast.success .tc-toast-icon { background: rgba(255, 255, 255, 0.22); }

.tc-toast.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.96), rgba(185, 28, 28, 0.96));
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 22px 48px -20px rgba(239, 68, 68, 0.7);
}

.tc-toast.error .tc-toast-icon { background: rgba(255, 255, 255, 0.22); }

.tc-toast.info {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.96), rgba(109, 40, 217, 0.96));
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 22px 48px -20px rgba(139, 92, 246, 0.75);
}

.tc-toast.info .tc-toast-icon { background: rgba(255, 255, 255, 0.22); }

/* Mobildə alt naviqasiya panelinin üstündə dayan */
@media (max-width: 768px) {
    .tc-toast-wrap {
        bottom: calc(78px + env(safe-area-inset-bottom, 0px));
        width: calc(100% - 24px);
        align-items: stretch;
    }

    .tc-toast {
        border-radius: 16px;
        font-size: 13px;
        padding: 12px 16px 12px 13px;
    }
}

/* -----------------------------------------------------------------------------
   HEADER SƏBƏT DÜYMƏSİ
   -------------------------------------------------------------------------- */
.header-cart-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    min-width: 42px;
    padding: 0 14px;
    border-radius: 12px;
    color: #e9e9f2;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.10);
    border: 1px solid rgba(139, 92, 246, 0.25);
    transition: all .25s ease;
    flex-shrink: 0;
}

.header-cart-btn i { font-size: 15px; color: var(--tc-violet-l); transition: transform .25s ease; }

.header-cart-btn:hover {
    background: rgba(139, 92, 246, 0.22);
    border-color: rgba(139, 92, 246, 0.5);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 12px 26px -14px rgba(139, 92, 246, 0.9);
}

.header-cart-btn:hover i { transform: scale(1.08); }

.header-cart-btn.has-items {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(236, 72, 153, 0.16));
    border-color: rgba(139, 92, 246, 0.45);
}

.tc-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--tc-violet) 0%, var(--tc-pink) 100%);
    border: 2px solid #0a0a0f;
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.6);
}

.tc-badge.visible { display: flex; }

.tc-badge.bump { animation: tcBump .45s cubic-bezier(.2, .8, .2, 1); }

@keyframes tcBump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.45); }
    100% { transform: scale(1); }
}

/* Header-də səbət düyməsi mobil görünüşdə yalnız ikon */
@media (max-width: 1200px) {
    .header-cart-btn .header-cart-label { display: none; }
    .header-cart-btn { padding: 0 12px; }
}

/* Mobil header-də (header-right-mobile) kompakt variant */
.header-cart-mobile {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    color: #e9e9f2;
    text-decoration: none;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    flex-shrink: 0;
}

.header-cart-mobile i { font-size: 16px; color: var(--tc-violet-l); }

.header-cart-mobile:active { background: rgba(139, 92, 246, 0.25); }

/* -----------------------------------------------------------------------------
   ALT NAVİQASİYADA SƏBƏT BADGE-İ
   -------------------------------------------------------------------------- */
.bottom-nav-item { position: relative; }

.bottom-nav-item .tc-badge {
    top: 2px;
    right: 50%;
    margin-right: -22px;
    border-color: #0a0a0f;
    z-index: 2;
}

/* Yan menyudaki səbət sətri */
.side-menu-nav a .tc-badge {
    position: static;
    margin-left: auto;
    border: none;
    box-shadow: none;
}

/* -----------------------------------------------------------------------------
   "SƏBƏTƏ ƏLAVƏ ET" DÜYMƏSİ (məhsul səhifəsi)
   -------------------------------------------------------------------------- */
.ts-btn-cart {
    position: relative;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 22px;
    margin-bottom: 12px;
    border-radius: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    color: #ddd6fe;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.16) 0%, rgba(236, 72, 153, 0.08) 100%);
    border: 1px solid rgba(139, 92, 246, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease, background .25s ease, border-color .25s ease;
}

.ts-btn-cart i { font-size: 15px; }

.ts-btn-cart:hover:not(:disabled) {
    color: #fff;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.32) 0%, rgba(236, 72, 153, 0.18) 100%);
    border-color: rgba(139, 92, 246, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 16px 34px -16px rgba(139, 92, 246, 0.9);
}

.ts-btn-cart:active:not(:disabled) { transform: translateY(0) scale(.99); }

.ts-btn-cart:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.ts-btn-cart.is-loading { pointer-events: none; opacity: .75; }

.ts-btn-cart.is-done {
    color: #fff;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(5, 150, 105, 0.2));
    border-color: rgba(16, 185, 129, 0.55);
}

/* -----------------------------------------------------------------------------
   MƏHSUL KARTLARINDA SÜRƏTLİ SƏBƏT DÜYMƏSİ
   -------------------------------------------------------------------------- */
.quick-cart-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 4;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.95), rgba(109, 40, 217, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 24px -10px rgba(139, 92, 246, 0.95);
    opacity: 0;
    transform: translateY(6px) scale(.9);
    transition: opacity .28s ease, transform .28s cubic-bezier(.2, .8, .2, 1), background .25s ease;
}

.cat-product-card:hover .quick-cart-btn,
.popular-product-card:hover .quick-cart-btn,
.product-card:hover .quick-cart-btn {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.quick-cart-btn:hover {
    background: linear-gradient(135deg, var(--tc-violet), var(--tc-pink));
    transform: translateY(-2px) scale(1.05);
}

.quick-cart-btn.is-loading { pointer-events: none; opacity: .8; }

.quick-cart-btn.is-done {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.98), rgba(5, 150, 105, 0.98));
    box-shadow: 0 10px 24px -10px rgba(16, 185, 129, 0.95);
}

/* -----------------------------------------------------------------------------
   ALT NAVİQASİYA 6 ELEMENTƏ UYĞUNLAŞDIRMA (səbət əlavə olunduqdan sonra)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .mobile-bottom-nav .bottom-nav-item span {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
    }
}

@media (max-width: 400px) {
    .mobile-bottom-nav .bottom-nav-item {
        font-size: 9px !important;
        gap: 2px !important;
    }
    .mobile-bottom-nav .bottom-nav-item i { font-size: 16px !important; }
    .bottom-nav-item .tc-badge { margin-right: -18px; min-width: 17px; height: 17px; font-size: 9.5px; }
}

/* Toxunma cihazlarında hover yoxdur — düymə həmişə görünsün */
@media (hover: none), (max-width: 992px) {
    .quick-cart-btn {
        opacity: 1;
        transform: none;
        width: 34px;
        height: 34px;
        font-size: 13px;
        right: 8px;
        bottom: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tc-toast, .tc-badge, .ts-btn-cart, .quick-cart-btn { transition: none !important; animation: none !important; }
}

/* =============================================================================
   ƏLAVƏ SAHƏLƏR POPUP-I (Oyun ID və s.) — tcm- prefiksi: tenebris cart modal
   ============================================================================= */
.tcm-overlay {
    position: fixed;
    inset: 0;
    z-index: 100010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 4, 8, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
}

.tcm-overlay.open {
    opacity: 1;
    visibility: visible;
}

body.tcm-lock { overflow: hidden; }

.tcm-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 24px;
    font-family: 'Inter', sans-serif;
    color: #f4f4f8;
    background: linear-gradient(150deg, rgba(24, 24, 38, 0.97) 0%, rgba(13, 13, 22, 0.98) 100%);
    border: 1px solid rgba(139, 92, 246, 0.28);
    box-shadow: 0 44px 90px -40px rgba(0, 0, 0, 0.98),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: translateY(18px) scale(.97);
    transition: transform .34s cubic-bezier(.2, .8, .2, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.5) transparent;
}

.tcm-overlay.open .tcm-box { transform: translateY(0) scale(1); }

.tcm-box::-webkit-scrollbar { width: 6px; }
.tcm-box::-webkit-scrollbar-track { background: transparent; }
.tcm-box::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.45); border-radius: 999px; }

/* Üstdə işıq xətti */
.tcm-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.65), transparent);
}

.tcm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    font-size: 13px;
    color: #9a9ab0;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all .22s ease;
}

.tcm-close:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.5);
    border-color: rgba(239, 68, 68, 0.45);
    transform: rotate(90deg);
}

/* ---------- Başlıq ---------- */
.tcm-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-right: 40px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tcm-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    font-size: 19px;
    color: #ddd6fe;
    overflow: hidden;
    background: linear-gradient(140deg, rgba(139, 92, 246, 0.28), rgba(236, 72, 153, 0.14));
    border: 1px solid rgba(139, 92, 246, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tcm-thumb img { width: 100%; height: 100%; object-fit: cover; }

.tcm-head-text { min-width: 0; }

.tcm-eyebrow {
    display: block;
    margin-bottom: 5px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    color: var(--tc-violet-l, #a78bfa);
}

.tcm-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.3;
    color: #fff;
}

/* ---------- Sahələr ---------- */
.tcm-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tcm-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.tcm-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .3px;
    color: #b6b6ca;
}

.tcm-label em {
    color: #f87171;
    font-style: normal;
    font-weight: 800;
}

.tcm-input {
    width: 100%;
    padding: 13px 15px;
    border-radius: 13px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    outline: none;
    transition: background .22s ease, border-color .22s ease, box-shadow .22s ease;
    -webkit-appearance: none;
    appearance: none;
}

select.tcm-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a78bfa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.tcm-input::placeholder { color: #6f6f88; font-weight: 500; }

.tcm-input:focus {
    background: rgba(139, 92, 246, 0.09);
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}

.tcm-field.has-error .tcm-input {
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.07);
}

.tcm-error {
    font-size: 11.5px;
    font-weight: 600;
    color: #fca5a5;
}

/* ---------- ID yoxlama ---------- */
.tcm-lookup { margin-top: 14px; }

.tcm-lookup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    border-radius: 13px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: #ddd6fe;
    cursor: pointer;
    background: rgba(139, 92, 246, 0.11);
    border: 1px dashed rgba(139, 92, 246, 0.4);
    transition: all .25s ease;
}

.tcm-lookup-btn:hover:not(:disabled) {
    color: #fff;
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.65);
}

.tcm-lookup-btn:disabled { opacity: .6; cursor: not-allowed; }

.tcm-lookup-result {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid transparent;
}

.tcm-lookup-result.loading {
    color: #ddd6fe;
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.24);
}

.tcm-lookup-result.success {
    color: #bbf7d0;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.28);
}

.tcm-lookup-result.success i { color: #4ade80; }

.tcm-lookup-result.error {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.09);
    border-color: rgba(239, 68, 68, 0.28);
}

.tcm-lookup-result.error i { color: #f87171; }

/* ---------- Qeyd ---------- */
.tcm-note {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 16px;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 11.5px;
    line-height: 1.5;
    color: #9a9ab0;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.tcm-note i { color: var(--tc-green, #10b981); flex-shrink: 0; }

/* ---------- Düymələr ---------- */
.tcm-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.tcm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 14px 18px;
    border-radius: 14px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: .2px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease, filter .25s ease, background .25s ease;
}

.tcm-btn.primary {
    flex: 1;
    color: #fff;
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 45%, #ec4899 120%);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 36px -20px rgba(139, 92, 246, 0.95),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tcm-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 24px 44px -20px rgba(236, 72, 153, 0.9),
                inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.tcm-btn.primary:disabled { opacity: .7; cursor: not-allowed; transform: none; }

.tcm-btn.ghost {
    color: #b6b6ca;
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(255, 255, 255, 0.08);
}

.tcm-btn.ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
}

/* ---------- Mobil ---------- */
@media (max-width: 520px) {
    .tcm-overlay { padding: 0; align-items: flex-end; }

    .tcm-box {
        max-width: none;
        max-height: 92vh;
        padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px));
        border-radius: 24px 24px 0 0;
        border-bottom: none;
        transform: translateY(100%);
    }

    .tcm-overlay.open .tcm-box { transform: translateY(0); }

    .tcm-head { gap: 12px; padding-bottom: 15px; margin-bottom: 15px; }
    .tcm-thumb { width: 46px; height: 46px; border-radius: 13px; font-size: 17px; }
    .tcm-title { font-size: 15px; }
    .tcm-actions { flex-direction: column-reverse; }
    .tcm-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .tcm-overlay, .tcm-box, .tcm-btn, .tcm-input, .tcm-close, .tcm-lookup-btn {
        transition: none !important;
    }
}
