/* Panel görünümü: sakin bir zemin, tek vurgu rengi, yumuşak kenarlar.
   Bootstrap'in üzerine ince bir katman; bileşen yapısı değiştirilmez. */
:root {
    --app-bg: #f1f3f7;
    --app-surface: #ffffff;
    --app-border: #e3e7ee;
    --app-ink: #1d2433;
    --app-muted: #6b7686;
    --app-accent: #3d5afe;
    --app-navbar: #1b2233;
    --app-radius: 0.625rem;
}

body {
    background-color: var(--app-bg);
    color: var(--app-ink);
    -webkit-font-smoothing: antialiased;
}

/* --- Üst menü --- */

.app-navbar {
    background-color: var(--app-navbar);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.app-navbar .navbar-brand {
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #fff;
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.25);
}

.app-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.75%29' stroke-linecap='round' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Bağlantılar hap biçiminde: aktif olan dolu, diğerleri üzerine gelince hafifçe aydınlanır. */
.app-navbar .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9375rem;
    padding: 0.375rem 0.75rem;
    margin-right: 0.125rem;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.app-navbar .navbar-nav .nav-link:hover,
.app-navbar .navbar-nav .nav-link:focus {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
}

.app-navbar .navbar-nav .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.14);
    font-weight: 500;
}

.app-navbar .dropdown-menu {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
    padding: 0.375rem;
    margin-top: 0.375rem;
}

.app-navbar .dropdown-item,
.dropdown-menu .dropdown-item {
    border-radius: 0.375rem;
    padding: 0.4rem 0.625rem;
    font-size: 0.9375rem;
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--app-accent);
    color: #fff;
}

.app-user-button {
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 0.5rem;
    padding: 0.3rem 0.75rem;
}

.app-user-button:hover,
.app-user-button:focus {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
}

/* --- Sayfa başlıkları --- */

main h1 {
    font-weight: 600;
    letter-spacing: -0.015em;
}

/* --- Kartlar ve tablolar --- */

.card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--app-border);
    font-weight: 600;
    padding: 0.75rem 1rem;
}

/* Sütun başlıkları küçük ve sessiz; veri satırları öne çıksın. */
.table > thead > tr > th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
    background-color: #f8f9fb;
    border-bottom: 1px solid var(--app-border);
    white-space: nowrap;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
}

.card > .table-responsive > .table > thead > tr > th:first-child,
.card > .table-responsive > .table > tbody > tr > td:first-child {
    padding-left: 1rem;
}

.card > .table-responsive > .table > thead > tr > th:last-child,
.card > .table-responsive > .table > tbody > tr > td:last-child {
    padding-right: 1rem;
}

.table > tbody > tr > td {
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    border-color: var(--app-border);
}

.table > tbody > tr:last-child > td {
    border-bottom: 0;
}

.table-hover > tbody > tr:hover > * {
    background-color: #f6f8fc;
}

/* Kart içindeki tablonun köşeleri kartın köşelerini taşırmasın. */
.card > .table-responsive {
    border-bottom-left-radius: var(--app-radius);
    border-bottom-right-radius: var(--app-radius);
}

/* --- Form ve düğmeler --- */

.form-control,
.form-select {
    border-color: var(--app-border);
    border-radius: 0.5rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 0.2rem rgba(61, 90, 254, 0.15);
}

.btn {
    border-radius: 0.5rem;
}

.btn-primary {
    --bs-btn-bg: var(--app-accent);
    --bs-btn-border-color: var(--app-accent);
    --bs-btn-hover-bg: #3149d8;
    --bs-btn-hover-border-color: #3149d8;
    --bs-btn-active-bg: #2b41c2;
    --bs-btn-active-border-color: #2b41c2;
}

.badge {
    font-weight: 500;
    letter-spacing: 0.01em;
}

.pagination {
    --bs-pagination-border-color: var(--app-border);
    --bs-pagination-active-bg: var(--app-accent);
    --bs-pagination-active-border-color: var(--app-accent);
    --bs-pagination-color: var(--app-ink);
}

.alert {
    border-radius: var(--app-radius);
    border-width: 1px;
}

/* --- Sayfaya özel --- */

.auth-wrapper {
    min-height: 100vh;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 0.875rem;
}

.audit-details pre {
    max-width: 520px;
    white-space: pre-wrap;
    word-break: break-word;
}

.marketplace-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.marketplace-logo-lg {
    max-width: 96px;
    max-height: 48px;
    object-fit: contain;
}

.text-prewrap {
    white-space: pre-wrap;
}

.permission-group + .permission-group {
    border-top: 1px solid var(--app-border);
}

/* Ürün listesi: pazaryeri bağlantıları soldan sağa yan yana, sığmayan alt satıra geçer.
   Her kutu mağaza, fiyat ve ilan durumunu birlikte taşır. Stok tektir ve depodan gelir;
   ürün adının yanında bir kez gösterilir. */
.store-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
}

.store-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background: var(--app-surface);
}

.store-link:hover {
    border-color: #c8cfdc;
    background: #fbfcfe;
}

/* Sipariş listesi: ürün adları uzunsa tek satırda kısaltılır, tamamı ipucunda görünür. */
.order-items {
    max-width: 22rem;
}

/* Decodo istek günlüğü: uzun adresler satır taşırmadan kırılır. */
.scrape-url {
    max-width: 34rem;
    word-break: break-all;
}

/* Ürün adının önündeki depo etiketi */
.warehouse-badge {
    font-size: .72em;
    font-weight: 600;
    vertical-align: .12em;
}

/* --- Ana sayfa ---
   Grafik renkleri doğrulanmış paletten: seri mavisi #2a78d6, ızgara #e1e0d9, eksen #c3c2b7.
   Durum renkleri (iyi/uyarı/ciddi/kritik) yalnızca durum için; her zaman simge ve metinle birlikte. */

.dash-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.dash-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dash-tile {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
    padding: 1rem 1.125rem;
    color: inherit;
    text-decoration: none;
}

.dash-tile-link:hover {
    border-color: #c5cbd6;
    color: inherit;
}

.dash-tile-label {
    font-size: 0.8125rem;
    color: var(--app-muted);
    margin-bottom: 0.25rem;
}

.dash-tile-value {
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.dash-tile-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.5rem;
}

.dash-spark {
    flex-shrink: 0;
    overflow: visible;
}

.dash-delta {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-top: 0.25rem;
    color: var(--app-muted);
}

.dash-delta span {
    font-weight: 400;
    color: var(--app-muted);
}

.dash-delta.is-up {
    color: #006300;
}

.dash-delta.is-down {
    color: #d03b3b;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dash-span-2 {
    grid-column: span 2;
}

@media (max-width: 991.98px) {
    .dash-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .dash-span-2 {
        grid-column: auto;
    }
}

.dash-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dash-card {
    padding: 1rem 1.125rem;
    margin: 0;
}

.dash-card.dash-flush {
    padding: 0;
}

.dash-card.dash-flush .dash-card-head {
    padding: 1rem 1.125rem 0.75rem;
    margin: 0;
}

.dash-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.dash-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.dash-card-sub {
    font-size: 0.75rem;
    color: var(--app-muted);
}

.dash-card-total {
    font-size: 1.125rem;
    font-weight: 600;
    text-align: right;
    line-height: 1.2;
}

.dash-card-total span {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--app-muted);
}

/* Grafik */
.dash-chart {
    position: relative;
}

.dash-chart svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.dash-card-head a {
    text-decoration: none;
    white-space: nowrap;
}

.dash-axis {
    font-size: 11px;
    fill: #898781;
    font-variant-numeric: tabular-nums;
}

.dash-axis.is-today {
    fill: var(--app-ink);
    font-weight: 600;
}

.dash-bar {
    outline: none;
}

.dash-bar-fill {
    transition: fill 0.12s ease;
}

.dash-bar:hover .dash-bar-fill,
.dash-bar:focus .dash-bar-fill {
    fill: #1c5cab;
}

.dash-bar:hover .dash-bar-hit,
.dash-bar:focus .dash-bar-hit {
    fill: rgba(42, 120, 214, 0.06);
}

.dash-tip {
    position: absolute;
    top: 0;
    left: 0;
    transform: translate(-50%, calc(-100% - 8px));
    pointer-events: none;
    white-space: nowrap;
    background: #1d2433;
    color: #ffffff;
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.18);
    z-index: 2;
}

.dash-table-toggle {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
}

.dash-table-toggle summary {
    color: var(--app-muted);
    cursor: pointer;
}

.dash-table-toggle .table-responsive {
    max-height: 16rem;
    margin-top: 0.5rem;
}

/* Pazaryeri sıralaması */
.dash-rank {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.dash-rank-top {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.dash-rank-name {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.dash-rank-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.dash-rank-bar {
    display: block;
    width: 100%;
    height: 6px;
    margin: 0.3rem 0 0.15rem;
}

.dash-rank-sub {
    font-size: 0.75rem;
    color: var(--app-muted);
}

/* Durum satırları */
.dash-status {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dash-status > li + li {
    border-top: 1px solid var(--app-border);
}

.dash-status-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.55rem 0;
    color: inherit;
    text-decoration: none;
    font-size: 0.875rem;
}

a.dash-status-row:hover {
    color: var(--app-accent);
}

.dash-status-go {
    margin-left: auto;
    color: var(--app-muted);
    font-size: 1.1rem;
}

.dash-status-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
}

.dash-status-icon.is-good { background: #0ca30c; }
.dash-status-icon.is-warning { background: #fab219; color: #1d2433; }
.dash-status-icon.is-serious { background: #ec835a; color: #1d2433; }
.dash-status-icon.is-critical { background: #d03b3b; }

/* Mağaza bağlantıları */
.dash-stores {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.5rem;
}

.dash-store {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.dash-store-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-weight: 600;
}

.dash-store-meta {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--app-muted);
}

.dash-store-error {
    font-weight: 400;
    font-size: 0.75rem;
    color: #d03b3b;
    overflow-wrap: anywhere;
}

/* Son siparişler */
.dash-orders-item {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-order-status {
    font-weight: 500;
    background: #eef1f5;
    color: #3a4456;
}

.dash-order-status.is-new,
.dash-order-status.is-approved { background: #e3eefc; color: #184f95; }
.dash-order-status.is-preparing,
.dash-order-status.is-invoiced { background: #fdf1d8; color: #7a5200; }
.dash-order-status.is-shipped { background: #e4f0fb; color: #104281; }
.dash-order-status.is-delivered { background: #e2f3e2; color: #006300; }
.dash-order-status.is-cancelled,
.dash-order-status.is-returned,
.dash-order-status.is-return_requested { background: #fbe6e6; color: #9b2424; }

/* Anahtar-değer listesi */
.dash-kv {
    margin: 0;
}

.dash-kv > div {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    font-size: 0.875rem;
}

.dash-kv > div + div {
    border-top: 1px solid var(--app-border);
}

.dash-kv dt {
    font-weight: 400;
    color: var(--app-muted);
}

.dash-kv dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Ana sayfa: son giden SMS'ler */
.dash-status-icon.is-info { background: #2a78d6; }

.dash-sub-title {
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 0.875rem 0 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--app-border);
}

.dash-sms {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dash-sms > li {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.5rem 0;
    font-size: 0.8125rem;
}

.dash-sms > li + li {
    border-top: 1px solid var(--app-border);
}

.dash-sms .dash-status-icon {
    margin-top: 0.1rem;
}

.dash-sms-body {
    min-width: 0;
    flex: 1;
}

.dash-sms-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 0.5rem;
}

.dash-sms-meta a {
    font-weight: 600;
    text-decoration: none;
}

.dash-sms-text {
    color: var(--app-muted);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dash-more {
    display: inline-block;
    margin-top: 0.25rem;
    text-decoration: none;
}

/* Maliyet takibi: satır içi maliyet alanı */
.cost-input {
    width: 9rem;
}

/* Raporlar */
.dash > .report-block {
    margin-bottom: 1rem;
}

.report-filters {
    flex-direction: row;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.report-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.report-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.report-form .form-control,
.report-form .form-select {
    width: auto;
}

.report-prev {
    font-size: 0.75rem;
    color: var(--app-muted);
    margin-top: 0.125rem;
}

.report-slash {
    color: var(--app-muted);
    font-weight: 400;
}

.report-block.dash-flush .table > :not(caption) > * > :first-child {
    padding-left: 1.125rem;
}

.report-block.dash-flush .table > :not(caption) > * > :last-child {
    padding-right: 1.125rem;
}

/* Decodo istekleri grafiği */
.scrape-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--app-muted);
    margin-bottom: 0.25rem;
}

.scrape-legend svg {
    margin-right: 0.25rem;
    vertical-align: -1px;
}

/* Ürün sayfası: otomatik fiyat anahtarından sonra dönülen ilan satırı */
.mapping-row {
    scroll-margin-top: 5rem;
}

.mapping-row:target > td {
    background-color: #fff6d6;
}

/* İlan açma */
.category-picker {
    position: relative;
}

.category-picker-selected {
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

.category-picker-results {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    max-height: 20rem;
    overflow-y: auto;
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.12);
}

.publish-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.publish-image {
    position: relative;
    display: block;
    width: 6.5rem;
    height: 6.5rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    overflow: hidden;
    cursor: pointer;
    background: #fff;
}

.publish-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.publish-image .form-check-input {
    position: absolute;
    top: 0.375rem;
    left: 0.375rem;
    margin: 0;
}

.publish-images.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Pazaryeri adının önündeki küçük logo */
.mp-logo {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    vertical-align: -3px;
    margin-right: 4px;
    flex-shrink: 0;
}
