:root {
    --primary: #6f42c1;
    --secondary: #8b5cf6;
    --accent: #ffbd00;
    --accent-warm: #ff8a3d;
    --dark-bg: #010101;
    --panel-bg: #0e0e12;
    --panel-bg-2: #15151c;
    --card-bg: #1a1a22;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --text-muted: rgba(255, 255, 255, 0.6);
    --text-dim: rgba(255, 255, 255, 0.4);
}

* { box-sizing: border-box; }

html {
    touch-action: manipulation;
    overscroll-behavior-y: none;
}

body {
    margin: 0;
    font-family: 'Nunito Sans', 'Segoe UI', Tahoma, sans-serif;
    background: var(--dark-bg);
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

.text-accent { color: var(--accent); }

/* Mobile/Desktop visibility toggles */
.desktop-only { display: none; }

/* ============================================================
   TOP BAR (mobile)
   ============================================================ */
.kt-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(14, 14, 18, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.kt-bar-logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.kt-bar-logo img {
    max-height: 38px;
    width: auto;
}

.kt-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 4px 14px rgba(111, 66, 193, 0.35);
}

.kt-bar-btn:hover:not(:disabled) { transform: translateY(-1px); }

.kt-bar-btn-right {
    background: linear-gradient(135deg, var(--accent-warm), var(--accent));
    color: #1a1a1a;
    box-shadow: 0 4px 14px rgba(255, 138, 61, 0.35);
}

.kt-bar-btn:disabled {
    background: var(--panel-bg-2);
    color: var(--text-dim);
    box-shadow: none;
    cursor: not-allowed;
}

.kt-bar-btn i { font-size: 16px; }

.kt-bar-btn-stack {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    align-items: flex-start;
}

.kt-bar-btn-stack strong { font-size: 14px; font-weight: 800; }
.kt-bar-btn-stack span { font-size: 11px; opacity: 0.85; }

@media (max-width: 380px) {
    .kt-bar-btn { padding: 8px 10px; font-size: 12px; }
    .kt-bar-btn-stack strong { font-size: 13px; }
    .kt-bar-logo img { max-height: 32px; }
}

/* ============================================================
   PAGE
   ============================================================ */
.kt-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 14px 60px;
}

.kt-howto-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent-warm), var(--accent));
    color: #1a1a1a;
    border: none;
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(255, 138, 61, 0.3);
    transition: transform 0.15s ease;
    margin-bottom: 8px;
}

.kt-howto-pill:hover { transform: translateY(-1px); }
.kt-howto-pill i { font-size: 18px; }

/* ============================================================
   BRACELET SECTION
   ============================================================ */
.kt-bracelet-section {
    width: 100%;
    max-width: 460px;
    margin: 12px auto 32px;
    aspect-ratio: 1;
    padding: 12px;
    position: relative;
}

.kt-bracelet-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(111, 66, 193, 0.18) 0%, transparent 65%);
    pointer-events: none;
    z-index: -1;
}

.kt-bracelet {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.kt-bracelet-slot { cursor: pointer; transition: transform 0.15s ease; }

.kt-bracelet-slot .slot-empty {
    fill: rgba(255, 255, 255, 0.05);
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 1;
    stroke-dasharray: 2, 2;
    transition: fill 0.2s ease, stroke 0.2s ease;
}

.kt-bracelet-slot.is-dropzone .slot-empty {
    fill: rgba(255, 189, 0, 0.2);
    stroke: var(--accent);
    stroke-width: 2;
    stroke-dasharray: none;
}

/* ============================================================
   GALLERY (mobile yatay rail + desktop grid)
   ============================================================ */
.kt-gallery-section {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px 0;
    margin: 0 -2px;
}

.kt-search {
    position: relative;
    margin: 0 14px 12px;
}

.kt-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 16px;
}

.kt-search input {
    width: 100%;
    background: var(--panel-bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px 12px 42px;
    color: #fff;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.kt-search input:focus { border-color: var(--primary); }
.kt-search input::placeholder { color: var(--text-dim); }

.kt-stones-rail {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 14px 8px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
}

.kt-stones-rail::-webkit-scrollbar { height: 6px; }
.kt-stones-rail::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.kt-stones-rail .kt-stone {
    flex: 0 0 110px;
    scroll-snap-align: start;
}

/* Stone card */
.kt-stone {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 8px 10px;
    text-align: center;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    transition: border-color 0.2s, transform 0.15s ease;
    position: relative;
}

.kt-stone:hover { border-color: var(--accent); }
.kt-stone:active { cursor: grabbing; }

.kt-stone.is-dragging {
    opacity: 0.35;
    transform: scale(0.95);
}

.kt-stone-bead {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 8px;
    box-shadow:
        inset -5px -5px 10px rgba(0, 0, 0, 0.4),
        inset 5px 5px 10px rgba(255, 255, 255, 0.25),
        0 3px 8px rgba(0, 0, 0, 0.4);
    position: relative;
    pointer-events: none;
    display: block;
}

.kt-stone-bead::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 32%;
    height: 32%;
    background: radial-gradient(circle, rgba(255,255,255,0.55) 0%, transparent 70%);
    border-radius: 50%;
}

.kt-stone-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 8px;
    display: block;
    pointer-events: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* Görsel yüklenince fallback gradient'i gizle */
.kt-stone:has(.kt-stone-img) .kt-stone-bead-fallback {
    display: none;
}
/* :has desteklemeyen tarayıcılar için yedek: img onerror img'i remove edince
   fallback bead her zaman görünür kalır (HTML'de span altta zaten var) */
.kt-stone.img-missing .kt-stone-bead-fallback {
    display: block;
}

.kt-stone-name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    display: block;
    margin-bottom: 2px;
}

.kt-stone-price {
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
    display: block;
}

.kt-stone-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
    line-height: 1.2;
    color: var(--text-muted);
    margin-top: 3px;
    max-height: 2.4em;
}

.kt-stones-empty {
    flex: 1;
    text-align: center;
    color: var(--text-dim);
    padding: 24px 12px;
    font-size: 13px;
    grid-column: 1 / -1;
}

/* ============================================================
   DRAG GHOST
   ============================================================ */
.kt-drag-ghost {
    position: fixed;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    transition: opacity 0.15s ease;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.6);
}

.kt-drag-ghost-bead,
.kt-drag-ghost-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow:
        inset -5px -5px 10px rgba(0, 0, 0, 0.4),
        inset 5px 5px 10px rgba(255, 255, 255, 0.25);
}

.kt-drag-ghost-img {
    object-fit: cover;
    display: none;
}

.kt-drag-ghost.is-active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
}

/* ============================================================
   MODAL
   ============================================================ */
.kt-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.kt-modal.is-hidden { display: none; }

.kt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
}

.kt-modal-box {
    position: relative;
    background: var(--panel-bg);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.kt-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--panel-bg-2);
    border: 1px solid var(--border);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.kt-modal-close:hover { border-color: var(--accent); color: var(--accent); }

.kt-modal-header { padding: 24px 24px 0; text-align: center; }

.kt-modal-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
}

.kt-modal-title i { color: var(--accent); }

.kt-modal-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 8px 0 0;
}

.kt-modal-body { padding: 22px 24px; }
.kt-modal-footer { padding: 0 24px 24px; }

.kt-modal-footer .kt-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

.kt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    font-family: inherit;
}

.kt-btn-primary {
    background: linear-gradient(135deg, var(--accent-warm), var(--accent));
    color: #1a1a1a;
}

.kt-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255, 138, 61, 0.4);
}

/* SIZE MODAL */
.kt-size-label {
    color: var(--accent-warm);
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 10px;
}

.kt-size-label span { color: #fff; }

.kt-size-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 18px;
}

@media (max-width: 480px) {
    .kt-size-grid { grid-template-columns: repeat(7, 1fr); gap: 5px; }
}

@media (max-width: 360px) {
    .kt-size-grid { grid-template-columns: repeat(5, 1fr); }
}

.kt-size-option {
    background: var(--panel-bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 2px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #fff;
    font-family: inherit;
}

.kt-size-option:hover { border-color: var(--accent); }

.kt-size-option.is-active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: var(--secondary);
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.45);
}

.kt-size-number { display: block; font-size: 16px; font-weight: 800; }
.kt-size-unit { display: block; font-size: 9px; color: var(--text-muted); margin-top: 2px; }
.kt-size-option.is-active .kt-size-unit { color: rgba(255, 255, 255, 0.85); }

.kt-bead-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-bg-2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 14px;
}

.kt-bead-info span { color: var(--text-muted); }
.kt-bead-info strong { color: var(--accent); font-weight: 800; font-size: 16px; }

.kt-help-card {
    display: flex;
    gap: 12px;
    background: rgba(255, 189, 0, 0.08);
    border: 1px solid rgba(255, 189, 0, 0.2);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.kt-help-card i { color: var(--accent); font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.kt-help-card strong { display: block; color: #fff; margin-bottom: 2px; }

/* HOWTO MODAL */
.kt-steps { list-style: none; padding: 0; margin: 0 0 16px; }

.kt-steps li {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.kt-steps li:last-child { border-bottom: none; }

.kt-step-no {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-warm), var(--accent));
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
}

.kt-steps strong { display: block; font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.kt-steps p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.4; }
.kt-steps em { font-style: normal; color: var(--accent); font-weight: 700; }

.kt-video-placeholder {
    background: var(--panel-bg-2);
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    padding: 32px 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

.kt-video-placeholder i { display: block; font-size: 32px; margin-bottom: 6px; color: var(--text-dim); }

/* ============================================================
   TOAST
   ============================================================ */
.kt-toast {
    position: fixed;
    top: 76px;
    right: 16px;
    background: linear-gradient(135deg, #1f7a3e, #2ea862);
    color: #fff;
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 200;
    transform: translateX(420px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 340px;
}

.kt-toast.is-show { transform: translateX(0); }
.kt-toast i { font-size: 24px; }
.kt-toast strong { display: block; font-size: 14px; }
.kt-toast span { font-size: 12px; opacity: 0.9; }

@media (max-width: 480px) {
    .kt-toast {
        top: auto;
        bottom: 16px;
        left: 12px;
        right: 12px;
        max-width: none;
        transform: translateY(140px);
    }
    .kt-toast.is-show { transform: translateY(0); }
}

/* ============================================================
   DESKTOP LAYOUT (≥ 1024px)
   ============================================================ */
@media (min-width: 1024px) {
    .desktop-only { display: block; }
    .mobile-only { display: none !important; }

    .kt-page {
        max-width: 1440px;
        display: grid;
        grid-template-columns: 340px 1fr 340px;
        gap: 24px;
        padding: 24px;
        align-items: start;
    }

    /* Sol panel: boyut + arama + 3-col grid scroll */
    .kt-side-left {
        background: var(--panel-bg);
        border: 1px solid var(--border);
        border-radius: 18px;
        padding: 18px;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
        position: sticky;
        top: 24px;
    }

    .kt-side-section { margin-bottom: 16px; }
    .kt-side-section:last-child { margin-bottom: 0; }

    .kt-side-title {
        font-size: 13px;
        font-weight: 700;
        margin-bottom: 10px;
        color: #fff;
    }

    .kt-side-title-accent { color: var(--accent-warm); font-size: 15px; }
    .kt-side-title-accent span { color: #fff; }

    .kt-side-left .kt-size-grid { grid-template-columns: repeat(7, 1fr); margin-bottom: 0; gap: 4px; }
    .kt-side-left .kt-size-option { padding: 8px 2px; }
    .kt-side-left .kt-size-number { font-size: 14px; }

    .kt-side-left .kt-search { margin: 0; }

    .kt-stones-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .kt-stones-grid .kt-stone {
        padding: 10px 6px 8px;
    }

    .kt-stones-grid .kt-stone-bead,
    .kt-stones-grid .kt-stone-img {
        width: 52px;
        height: 52px;
    }

    .kt-stones-grid .kt-stone-name { font-size: 11px; }
    .kt-stones-grid .kt-stone-price { font-size: 10px; }

    /* Orta: bileklik */
    .kt-bracelet-section { max-width: 560px; margin: 0 auto; }

    /* Sağ panel: özet + sepete ekle */
    .kt-side-right {
        background: var(--panel-bg);
        border: 1px solid var(--border);
        border-radius: 18px;
        padding: 18px;
        position: sticky;
        top: 24px;
    }

    .kt-howto-pill-right {
        width: 100%;
        justify-content: center;
        margin-bottom: 16px;
    }

    .kt-side-meta {
        background: var(--panel-bg-2);
        border-radius: 12px;
        padding: 12px 14px;
        margin-bottom: 14px;
    }

    .kt-side-meta-row {
        font-size: 13px;
        color: var(--text-muted);
        padding: 4px 0;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .kt-side-meta-row strong { color: #fff; font-weight: 700; margin-left: 4px; }

    .kt-summary-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 16px;
        font-size: 13px;
    }

    .kt-summary-table th,
    .kt-summary-table td {
        text-align: left;
        padding: 10px 6px;
        border-bottom: 1px solid var(--border);
    }

    .kt-summary-table th {
        font-weight: 700;
        color: var(--text-muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .kt-summary-table td:last-child {
        text-align: right;
        font-weight: 700;
        color: #fff;
    }

    .kt-summary-empty {
        text-align: center !important;
        color: var(--text-dim);
        font-style: italic;
        padding: 20px 8px !important;
    }

    .kt-summary-bead {
        display: inline-block;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        vertical-align: middle;
        margin-right: 6px;
        box-shadow:
            inset -2px -2px 4px rgba(0, 0, 0, 0.35),
            inset 2px 2px 4px rgba(255, 255, 255, 0.25);
    }

    .kt-summary-count {
        background: rgba(255, 189, 0, 0.15);
        color: var(--accent);
        padding: 2px 6px;
        border-radius: 50px;
        font-size: 10px;
        font-weight: 700;
        margin-left: 4px;
    }

    .kt-btn-cart-wide {
        width: 100%;
        padding: 14px;
        background: linear-gradient(135deg, var(--accent-warm), var(--accent));
        color: #1a1a1a;
        font-size: 15px;
        font-weight: 800;
        box-shadow: 0 4px 14px rgba(255, 138, 61, 0.35);
    }

    .kt-btn-cart-wide:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 6px 18px rgba(255, 138, 61, 0.45);
    }

    .kt-btn-cart-wide:disabled {
        background: var(--panel-bg-2);
        color: var(--text-dim);
        cursor: not-allowed;
        box-shadow: none;
    }
}

/* Çok geniş ekranlar: container açılır */
@media (min-width: 1440px) {
    .kt-page { grid-template-columns: 360px 1fr 360px; gap: 32px; }
    .kt-bracelet-section { max-width: 600px; }
}
