/* ServaCP — sipariş yapılandırıcı (Eklenti ve Seçenekler)
   Tema değişkenleri .configurator üzerinde tanımlıdır; karanlık mod için
   html.dark altında yeniden yazılır. Client header'ındaki global
   "html.dark input/select { ... !important }" kuralları yüzünden form
   elemanlarının karanlık mod renkleri !important ile verilir. */

.configurator {
    --cfg-surface: #ffffff;
    --cfg-surface-soft: #f8fafc;
    --cfg-tile: #f1f5f9;
    --cfg-line: #e2e8f0;
    --cfg-line-strong: #cbd5e1;
    --cfg-text: #0f172a;
    --cfg-muted: #64748b;
    --cfg-brand: #0284c7;
    --cfg-brand-text: #0369a1;
    --cfg-brand-soft: #f0f9ff;
    --cfg-brand-line: #bae6fd;
    --cfg-ring: rgba(14, 165, 233, .16);
    --cfg-lift: 0 10px 24px -14px rgba(15, 23, 42, .35);
}

.dark .configurator {
    --cfg-surface: #1e293b;
    --cfg-surface-soft: #172033;
    --cfg-tile: rgba(148, 163, 184, .14);
    --cfg-line: #334155;
    --cfg-line-strong: #475569;
    --cfg-text: #e2e8f0;
    --cfg-muted: #94a3b8;
    --cfg-brand: #38bdf8;
    --cfg-brand-text: #7dd3fc;
    --cfg-brand-soft: rgba(56, 189, 248, .12);
    --cfg-brand-line: rgba(56, 189, 248, .55);
    --cfg-ring: rgba(56, 189, 248, .18);
    --cfg-lift: 0 10px 24px -14px rgba(0, 0, 0, .7);
}

/* ---------- Bölüm başlığı ---------- */

.config-section { margin: 0 0 26px; }
.config-section + .config-section { padding-top: 26px; border-top: 1px solid var(--cfg-line); }

.config-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
    padding: 0;
    border: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--cfg-text);
}
.config-section h3::before {
    content: "";
    width: 4px;
    height: 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, #38bdf8, #0284c7);
    flex-shrink: 0;
}
.config-section h3 span { color: #f43f5e; font-weight: 700; }

.config-note {
    margin: 0 0 14px 14px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--cfg-muted);
}
.config-choices { margin-top: 14px; }

/* ---------- Yerleşim ---------- */

.config-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.config-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--cfg-line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--cfg-surface);
}

/* ---------- Seçenek kartı ---------- */

.config-choice {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--cfg-line);
    border-radius: 14px;
    background: var(--cfg-surface);
    color: var(--cfg-text);
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.config-grid .config-choice:hover {
    border-color: var(--cfg-brand-line);
    box-shadow: var(--cfg-lift);
    transform: translateY(-1px);
}
.config-grid .config-choice:has(input:checked) {
    border-color: var(--cfg-brand);
    background: var(--cfg-brand-soft);
    box-shadow: 0 0 0 3px var(--cfg-ring);
}
.config-choice:focus-within { outline: 2px solid var(--cfg-brand); outline-offset: 3px; }

.config-list .config-choice {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 12px 14px;
}
.config-list .config-choice + .config-choice { border-top: 1px solid var(--cfg-line); }
.config-list .config-choice:hover:not(:has(input:checked)) { background: var(--cfg-surface-soft); }
.config-list .config-choice:has(input:checked) {
    background: var(--cfg-brand-soft);
    box-shadow: inset 3px 0 var(--cfg-brand);
}
/* Seçili satırda fiyat hapı zeminle aynı tona düşmesin. */
.config-list .config-choice:has(input:checked) strong { background: var(--cfg-surface); }

.config-choice-label,
.config-list > label {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-width: 0;
    cursor: pointer;
}

/* Kart görünümünde seçim düğmesi sağa alınır (markup değişmeden). */
.config-grid .config-choice-label > input[type="radio"] { order: 3; margin-left: auto; }
/* Yalnızca metin sütunu esner; ikon kutusu sabit kalır (kendisi de bir <span>). */
.config-choice-label > span:not(.config-icon-wrap) { flex: 1 1 auto; min-width: 0; }

.config-choice b {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.config-choice small {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--cfg-muted);
}
.config-choice strong {
    margin-left: auto;
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--cfg-brand-soft);
    color: var(--cfg-brand-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- İkon kutusu ---------- */

.config-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--cfg-tile);
    color: var(--cfg-brand);
    transition: background .18s ease;
}
.config-icon-wrap.is-flag {
    background: transparent;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px var(--cfg-line-strong);
}
.config-icon {
    display: block;
    width: 21px;
    height: 21px;
    object-fit: contain;
}
.config-icon-wrap.is-flag .config-icon { width: 34px; height: 34px; border-radius: 50%; }
.config-icon-wrap.is-glyph .config-icon { width: 19px; height: 19px; }
.config-list .config-icon-wrap { flex-basis: 30px; width: 30px; height: 30px; border-radius: 9px; }
.config-list .config-icon { width: 18px; height: 18px; }
.config-list .config-icon-wrap.is-flag .config-icon { width: 30px; height: 30px; }
.config-list .config-icon-wrap.is-glyph .config-icon { width: 17px; height: 17px; }

/* Kelime logoları (VMware gibi): kare kutuda harfler okunmayacak kadar
   inceliyor. Geniş kutu ve her iki temada da açık zemin verilir. */
.config-icon-wrap.is-wide,
.config-list .config-icon-wrap.is-wide {
    flex-basis: 56px;
    width: 56px;
    height: 34px;
    border-radius: 9px;
    background: #eef2f6;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .06);
}
.config-icon-wrap.is-wide .config-icon,
.config-list .config-icon-wrap.is-wide .config-icon { width: 46px; height: 22px; }

.config-choice:has(input:checked) .config-icon-wrap:not(.is-flag):not(.is-wide) { background: rgba(14, 165, 233, .14); }

/* ---------- Seçim düğmesi ---------- */

.config-choice input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 19px;
    height: 19px;
    margin: 0;
    flex-shrink: 0;
    border: 2px solid var(--cfg-line-strong);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.config-choice input[type="radio"]:hover { border-color: var(--cfg-brand); }
.config-choice input[type="radio"]:checked {
    border-color: #0284c7;
    background: #0284c7;
    box-shadow: inset 0 0 0 3.5px #fff;
}
.dark .config-choice input[type="radio"] {
    background: #0f172a !important;
    border-color: #475569 !important;
}
.dark .config-choice input[type="radio"]:checked {
    background: #38bdf8 !important;
    border-color: #38bdf8 !important;
    box-shadow: inset 0 0 0 3.5px #0f172a;
}

/* ---------- Sürüm seçici ---------- */

.config-version {
    width: 100%;
    margin-top: 12px;
    padding: 9px 30px 9px 11px;
    border: 1px solid var(--cfg-line);
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    color: var(--cfg-text);
    background-color: var(--cfg-surface-soft);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px 12px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.config-version:hover { border-color: var(--cfg-line-strong); }
.config-version:focus {
    outline: none;
    border-color: var(--cfg-brand);
    box-shadow: 0 0 0 3px var(--cfg-ring);
}
.dark .config-version {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E") !important;
}

/* ---------- Kullanılamayan seçenek ---------- */

.config-choice.is-unavailable {
    background: var(--cfg-surface-soft);
    border-style: dashed;
}
.config-grid .config-choice.is-unavailable:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--cfg-line);
}
.config-choice.is-unavailable label { cursor: not-allowed; }
.config-choice.is-unavailable .config-icon { filter: grayscale(1); opacity: .5; }
.config-choice.is-unavailable .config-icon-wrap { background: var(--cfg-tile); }
.config-choice.is-unavailable b,
.config-choice.is-unavailable small { color: var(--cfg-muted); }

/* "İstemiyorum" seçeneği nötr durur. */
.config-choice.config-none .config-icon-wrap { color: var(--cfg-muted); }
.config-choice.config-none strong { background: var(--cfg-tile); color: var(--cfg-muted); }

/* ---------- Kaynak <select> (JS devraldığında gizlenir) ---------- */

.config-source { width: 100%; padding: 10px; margin-bottom: 12px; }
.configurator.enhanced .config-source {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.configurator:not(.enhanced) .config-choices { display: none; }

/* ---------- Duyarlı ---------- */

@media (max-width: 900px) {
    .config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .config-grid { grid-template-columns: 1fr; }
    #checkoutForm > .flex { flex-direction: column; }
    #checkoutForm .w-80 { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .config-choice, .config-icon-wrap, .config-version, .config-choice input[type="radio"] { transition: none; }
    .config-grid .config-choice:hover { transform: none; }
}
