/* =====================================================================
   KURYELOJİ — components.css
   Tüm sayfalarda kullanılabilen hazır bileşenler:
   .btn  .badge  .card  .alert  .field  .dropdown-panel  .table  .empty  .toast
   ===================================================================== */

/* ---------- Butonlar ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 18px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #c33c4b; }

/* ---------- Rozetler ---------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--bg);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 700;
}
.badge-beta  { background: var(--brand-soft); color: var(--brand-dark); letter-spacing: .06em; }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red   { background: var(--red-soft);   color: var(--red); }
.badge-blue  { background: var(--blue-soft);  color: var(--blue); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }

/* ---------- Kart ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.card-head h2 { display: flex; align-items: center; gap: 10px; }
.card-head h2 .icon { color: var(--brand); }
.card-body { padding: 20px; }

/* ---------- Uyarı kutusu ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    margin: 14px 0;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
}
.alert-danger  { background: var(--red-soft);   color: #A52A39; }
.alert-success { background: var(--green-soft); color: #167A52; }
.alert-warning { background: var(--amber-soft); color: #9A6204; }

/* ---------- Form ---------- */
.field { display: block; margin-top: 16px; }
.field > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }

.input, .select, .textarea,
.input-icon input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus, .input-icon input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(255, 107, 44, .15);
}
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 38px; }

.select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--muted);
}
.select-wrap select {
    padding: 8px 4px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}
.select-wrap select:focus { outline: none; }

/* ---------- Açılır panel (profil vb.) ---------- */
.dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    z-index: 60;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .15s, transform .15s, visibility .15s;
}
[data-dropdown].is-open .dropdown-panel { opacity: 1; visibility: visible; transform: none; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.is-danger { color: var(--red); }
.dropdown-item.is-danger:hover { background: var(--red-soft); }

/* ---------- Tablo ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: 12.5px; font-weight: 700; background: #F8FAFB; }
.table tbody tr:hover { background: #FAFCFC; }

/* ---------- Boş durum ---------- */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
}
.empty .icon { color: #B5C2C8; }
.empty-lg { padding: 70px 20px; }
.empty-lg h2 { color: var(--text); font-size: 20px; }
.empty-lg p { max-width: 420px; }

/* ---------- İskelet yükleme ---------- */
.skeleton-row { display: grid; gap: 12px; }
.skeleton {
    height: 56px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, #EEF2F4 25%, #F7F9FA 50%, #EEF2F4 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Bildirim (toast) ---------- */
.toast-stack { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: grid; gap: 10px; }
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 380px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: toast-in .2s ease;
}
.toast-error   { background: var(--red); }
.toast-success { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Özet kutuları (kontör, geçmiş siparişler, raporlar) ---------- */
.kpi-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.kpi {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-value { font-size: 32px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-hint { color: var(--muted); font-size: 12px; }

.kpi-main { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi-main .kpi-label, .kpi-main .kpi-hint { color: #A9C2C7; }
.kpi-main .kpi-value { font-size: 40px; }
.kpi-main.is-empty { background: var(--red); border-color: var(--red); }
.kpi-main.is-empty .kpi-label, .kpi-main.is-empty .kpi-hint { color: #FFD9DD; }
@media (max-width: 1280px) { .kpi-row { grid-template-columns: 1fr 1fr; } }

/* ---------- Tarih alanı (filtre çubuklarında) ---------- */
.date-field { display: flex; flex-direction: column; gap: 3px; }
.date-field span { color: var(--muted); font-size: 12px; font-weight: 600; }
.date-field .input { width: auto; padding: 8px 10px; }

/* ---------- Tutar renkleri (artı yeşil, eksi kırmızı) ---------- */
.amount { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.amount-pos { color: var(--green); }
.amount-neg { color: var(--red); }

/* ---------- Açma/kapama anahtarı ---------- */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; flex: none; width: 46px; height: 26px; border-radius: 999px; background: #C5D0D6; transition: background .2s; }
.switch-ui::after {
    content: "";
    position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s;
}
.switch input:checked + .switch-ui { background: var(--green); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-text { font-weight: 600; min-width: 44px; }

/* ---------- Küçük yardımcılar ---------- */
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; cursor: pointer; }
.check input { accent-color: var(--brand); }
.age-late { color: var(--red) !important; font-weight: 700; }
