/* ==========================================================================
   Pricerio — tasarım sistemi çekirdeği
   Tokenlar, tipografi ölçeği ve tüm sayfalarda ortak kullanılan bileşenler.
   Her ölçü rem tabanlıdır; kök 16px olduğu için tarayıcı yazı boyutu
   ayarları ve tarayıcı zoom'u arayüzü doğru ölçekler.
   ========================================================================== */

:root {
    /* Pastel palet -------------------------------------------------------- */
    --bg: #f8fafc;
    --bg-soft: #fcf8ff;
    --surface: #ffffff;
    --surface-2: #f5f2fe;
    --surface-3: #efecf8;

    --line: #f1f5f9;
    --line-strong: #c7c4d7;

    --ink: #1b1b23;
    --ink-soft: #464554;
    --muted: #516072;
    --faint: #767586;

    --brand: #4648d4;
    --brand-ink: #2f2ebe;
    --brand-soft: #e1e0ff;
    --brand-softer: #f5f2fe;

    --mint: #137333;
    --mint-soft: #e6f4ea;
    --sky: #516072;
    --sky-soft: #d2e1f7;
    --amber: #904900;
    --amber-soft: #ffdcc5;
    --rose: #ba1a1a;
    --rose-soft: #ffdad6;
    --violet: #6063ee;
    --violet-soft: #e1e0ff;

    /* Tipografi ----------------------------------------------------------- */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Inter', var(--font);
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --fs-2xs: 0.6875rem;  /* 11px — yalnızca etiket/rozet */
    --fs-xs: 0.75rem;     /* 12px */
    --fs-sm: 0.8125rem;   /* 13px */
    --fs-base: 0.9375rem; /* 15px — gövde */
    --fs-md: 1rem;        /* 16px */
    --fs-lg: 1.125rem;    /* 18px */
    --fs-xl: 1.375rem;    /* 22px */
    --fs-2xl: 1.75rem;    /* 28px */
    --fs-3xl: 2.25rem;    /* 36px */
    --fs-4xl: 3rem;       /* 48px */

    /* Aralık ölçeği (8px tabanlı) ----------------------------------------- */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;

    /* Yüzey ---------------------------------------------------------------- */
    --radius-sm: 0.5rem;
    --radius: 0.875rem;
    --radius-lg: 1.25rem;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(44, 43, 63, 0.05);
    --shadow: 0 2px 4px rgba(44, 43, 63, 0.04), 0 8px 24px rgba(44, 43, 63, 0.06);
    --shadow-lg: 0 12px 40px rgba(44, 43, 63, 0.1);

    --ring: 0 0 0 3px rgba(70, 72, 212, 0.2);
}

/* Temel sıfırlama ---------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--fs-base);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--ink);
}

p { margin: 0; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: var(--radius-sm);
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Tipografi yardımcıları --------------------------------------------------- */
.eyebrow {
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-ink);
}

.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.tabular { font-variant-numeric: tabular-nums; }
.text-mint { color: var(--mint); }
.text-rose { color: var(--rose); }

/* Düğmeler ----------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 2.625rem;
    padding: 0 var(--sp-4);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }

.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-soft:hover { background: #e2e5fd; }

.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink-soft); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-ink); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }

.btn-danger { background: var(--rose-soft); color: var(--rose); }
.btn-danger:hover { background: #f9dfe5; }

.btn-sm { min-height: 2.125rem; padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.btn-block { width: 100%; }

/* Bağlantı görünümlü düğme (tablo içi eylemler) */
.btn-link {
    border: 0;
    background: none;
    padding: 0;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--brand-ink);
}
.btn-link:hover { text-decoration: underline; }
.btn-link.is-danger { color: var(--rose); }

/* Rozetler ----------------------------------------------------------------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 0.25rem var(--sp-3);
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    color: var(--ink-soft);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.pill.is-brand { background: var(--brand-soft); color: var(--brand-ink); }
.pill.is-success { background: var(--mint-soft); color: var(--mint); }
.pill.is-info { background: var(--sky-soft); color: var(--sky); }
.pill.is-warn { background: var(--amber-soft); color: var(--amber); }
.pill.is-danger { background: var(--rose-soft); color: var(--rose); }
.pill.is-violet { background: var(--violet-soft); color: var(--violet); }

a.pill:hover { text-decoration: none; filter: brightness(0.97); }

/* Kartlar ------------------------------------------------------------------ */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--line);
}
.card-head h2,
.card-head h3 { font-size: var(--fs-md); }
.card-body { padding: var(--sp-6); }
.card-body + .card-body { border-top: 1px solid var(--line); }
.card-tint { background: var(--bg-soft); }

/* Izgaralar ---------------------------------------------------------------- */
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stack { display: grid; gap: var(--sp-4); }
.stack-sm { display: grid; gap: var(--sp-2); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1; }

/* İstatistik kutusu -------------------------------------------------------- */
.stat {
    padding: var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.stat-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--muted);
}
.stat-icon {
    display: grid;
    place-items: center;
    width: 2rem; height: 2rem;
    border-radius: var(--radius-sm);
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: var(--fs-sm);
}
.stat-value {
    margin-top: var(--sp-3);
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat-meta { margin-top: var(--sp-1); font-size: var(--fs-xs); color: var(--muted); }
.stat-meta.is-up { color: var(--mint); }
.stat-meta.is-down { color: var(--rose); }

/* Ölçüm çubuğu ------------------------------------------------------------- */
.meter { display: grid; gap: var(--sp-2); }
.meter + .meter { margin-top: var(--sp-4); }
.meter-head {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    font-size: var(--fs-sm);
}
.meter-head b { font-variant-numeric: tabular-nums; }
.meter-track {
    height: 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    overflow: hidden;
}
.meter-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand) 0%, var(--violet) 100%);
}
.meter-fill.is-warn { background: linear-gradient(90deg, var(--amber) 0%, #e0aa62 100%); }
.meter-fill.is-danger { background: linear-gradient(90deg, var(--rose) 0%, #e88ba0 100%); }

/* Tablolar ----------------------------------------------------------------- */
.table-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table-scroll { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}
.table th {
    padding: var(--sp-3) var(--sp-5);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}
.table td {
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .cell-title { display: block; font-weight: 600; color: var(--ink); }
.table .cell-sub { display: block; font-size: var(--fs-xs); color: var(--muted); }
.table .cell-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .cell-actions { display: flex; gap: var(--sp-3); align-items: center; }

/* Formlar ------------------------------------------------------------------ */
.field { display: grid; gap: var(--sp-2); }
.field-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--ink-soft);
}
.field-hint { font-size: var(--fs-xs); color: var(--muted); }

.input, .select, .textarea {
    width: 100%;
    min-height: 2.625rem;
    padding: 0 var(--sp-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: var(--fs-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { padding: var(--sp-3); min-height: 6rem; line-height: 1.5; resize: vertical; }
.select { appearance: none; padding-right: var(--sp-8);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%2385839c' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--sp-3) center;
    background-size: 0.75rem;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--ring);
}
.input::placeholder { color: var(--faint); }

.form-grid {
    display: grid;
    gap: var(--sp-4);
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    align-items: end;
}
.form-grid .field-full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

.check {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--ink-soft);
    cursor: pointer;
}
.check input { width: 1rem; height: 1rem; accent-color: var(--brand); }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] { opacity: .6; }

/* Bildirim şeritleri ------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--fs-sm);
    line-height: 1.6;
}
.alert + .alert { margin-top: var(--sp-3); }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert a, .alert .btn-link { color: inherit; font-weight: 700; text-decoration: underline; }
.alert-success { background: var(--mint-soft); border-color: #c6e8da; color: #1f7a5e; }
.alert-info { background: var(--sky-soft); border-color: #cbe4f6; color: #2b6f9e; }
.alert-warn { background: var(--amber-soft); border-color: #f0dcba; color: #9a6a24; }
.alert-danger { background: var(--rose-soft); border-color: #f5d3db; color: #a94259; }

/* Boş durum ---------------------------------------------------------------- */
.empty {
    padding: var(--sp-10) var(--sp-6);
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    text-align: center;
    color: var(--muted);
    font-size: var(--fs-sm);
}
.empty-title {
    display: block;
    margin-bottom: var(--sp-2);
    font-family: var(--font-display);
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--ink);
}
.empty-actions { margin-top: var(--sp-5); display: flex; gap: var(--sp-2); justify-content: center; flex-wrap: wrap; }

/* Marka kilidi (panel + kimlik doğrulama + tanıtım) ------------------------ */
.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand em { font-style: normal; color: var(--brand); }
.brand-mark {
    display: grid;
    place-items: center;
    width: 2.25rem; height: 2.25rem;
    flex: none;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--brand) 0%, var(--violet) 100%);
    color: #fff;
    font-size: var(--fs-md);
}

/* Avatar ------------------------------------------------------------------- */
.avatar {
    display: grid;
    place-items: center;
    width: 2.25rem; height: 2.25rem;
    flex: none;
    border-radius: var(--radius-sm);
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: var(--fs-xs);
    font-weight: 700;
}
.avatar.is-violet { background: var(--violet-soft); color: var(--violet); }
.avatar.is-mint { background: var(--mint-soft); color: var(--mint); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-right: -0.5rem; border: 2px solid var(--surface); }

/* Etkinlik satırı ---------------------------------------------------------- */
.feed-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--line);
}
.feed-item:last-child { border-bottom: 0; padding-bottom: 0; }
.feed-item:first-child { padding-top: 0; }
.feed-body { min-width: 0; flex: 1; }
.feed-body b { display: block; font-size: var(--fs-sm); font-weight: 600; }
.feed-body span { display: block; font-size: var(--fs-xs); color: var(--muted); }
.feed-meta { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Kod / token -------------------------------------------------------------- */
.code-block {
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
    background: #2c2b3f;
    color: #e8e7f5;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    word-break: break-all;
}

/* Sayfalama ---------------------------------------------------------------- */
.pagination-wrap { margin-top: var(--sp-5); font-size: var(--fs-sm); }
.pagination-wrap nav { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.pagination-wrap svg { width: 1rem; height: 1rem; }
.pagination-wrap a,
.pagination-wrap span {
    display: inline-flex;
    align-items: center;
    min-height: 2.125rem;
    padding: 0 var(--sp-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-soft);
    text-decoration: none;
}
.pagination-wrap a:hover { border-color: var(--brand); color: var(--brand-ink); }
.pagination-wrap [aria-current="page"] span { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Duyarlı davranış --------------------------------------------------------- */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .card-body, .card-head { padding: var(--sp-4); }
    .table th, .table td { padding: var(--sp-3) var(--sp-4); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
