/* =====================================================================
   Resim07 — ortak stiller
   ===================================================================== */

:root {
    --brand: #2563eb;
    --brand-600: #1d4ed8;
    --brand-50: #eff6ff;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #0f172a;
    --text-2: #475569;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 6px 24px rgba(15, 23, 42, .06);
    --header-h: 60px;

    --bs-primary: var(--brand);
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--border);
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--bs-body-font-family); }

.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); }
.btn { border-radius: var(--radius-sm); font-weight: 500; }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--border); }
.form-control:focus, .form-select:focus { border-color: #93c5fd; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.form-label { font-size: .8125rem; font-weight: 600; color: var(--text-2); margin-bottom: .35rem; }
.input-group > .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.alert { border-radius: var(--radius-sm); }
.min-w-0 { min-width: 0; }

/* ---------- Marka ---------- */
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-weight: 700; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 1rem; }
.brand-text { font-size: 1.05rem; letter-spacing: -.01em; }

/* ---------- Giriş / hata sayfaları ---------- */
.auth-body { min-height: 100vh; min-height: 100dvh; background: radial-gradient(1200px 600px at 10% -10%, #dbeafe 0%, transparent 60%), var(--bg); }
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.auth-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-size: 1.5rem; margin-bottom: 16px; }
.auth-card.text-center .auth-icon { margin-inline: auto; }
.auth-icon-muted { background: #f1f5f9; color: var(--muted); }
.auth-icon-danger { background: #fef2f2; color: #dc2626; }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; letter-spacing: -.02em; }
.auth-subtitle { color: var(--muted); margin-bottom: 1.25rem; }

/* ---------- Ortak bileşenler ---------- */
.panel-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-subtitle { color: var(--muted); margin: .25rem 0 0; }

.search-box { position: relative; }
.search-box > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box .form-control { padding-left: 40px; }

.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state > i { font-size: 2.5rem; color: #cbd5e1; display: block; margin-bottom: 8px; }
.empty-state h2 { font-size: 1.125rem; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.empty-state p { max-width: 380px; margin: 0 auto 16px; }

.badge-soft { background: var(--brand-50); color: var(--brand-600); font-weight: 500; border-radius: 8px; padding: .4em .65em; }

.toast-stack { position: fixed; z-index: 1090; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast-stack .toast { border: 0; border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); }

/* =====================================================================
   KATALOG
   ===================================================================== */

.site-header { position: sticky; top: 0; z-index: 1020; height: var(--header-h); display: flex; align-items: center; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--border); }

.catalog-toolbar { position: sticky; top: var(--header-h); z-index: 1010; display: flex; flex-direction: column; gap: 10px; padding: 12px 0 10px; margin-top: -12px; margin-bottom: 8px; background: var(--bg); }
.catalog-toolbar .form-control { height: 46px; background: var(--surface); }
.view-toggle .btn { height: 46px; width: 46px; display: grid; place-items: center; background: var(--surface); }
.view-toggle .btn.active { background: var(--brand-50); color: var(--brand); border-color: #bfdbfe !important; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .8125rem; font-weight: 500; white-space: nowrap; cursor: pointer; transition: all .15s; user-select: none; }
.chip:hover { border-color: #bfdbfe; color: var(--brand); }
.chip .chip-count { font-size: .75rem; color: var(--muted); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.active .chip-count { color: rgba(255, 255, 255, .8); }

/* Ürün ızgarası */
.product-grid { display: grid; gap: 14px; }
.product-grid.view-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.product-grid.view-list { grid-template-columns: 1fr; gap: 8px; }

.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; }
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.product-media { position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; background: #f1f5f9; border: 0; padding: 0; overflow: hidden; cursor: zoom-in; }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.product-card:hover .product-media img { transform: scale(1.04); }
.product-media.no-image { cursor: default; display: grid; place-items: center; color: #cbd5e1; font-size: 2.25rem; }
.product-media.no-image span { display: block; font-size: .75rem; color: var(--muted); margin-top: 4px; }
.img-count { position: absolute; right: 8px; bottom: 8px; background: rgba(15, 23, 42, .72); color: #fff; font-size: .75rem; font-weight: 500; padding: 3px 8px; border-radius: 999px; }

.product-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-cat { font-size: .6875rem; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); font-weight: 600; }
.product-title { font-size: .9375rem; font-weight: 600; margin: 0; line-height: 1.35; color: var(--text); word-break: break-word; }
.product-meta { margin-top: auto; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-top: 4px; }
.product-code { font-size: .75rem; color: var(--muted); }
.product-price { font-size: 1.0625rem; font-weight: 700; color: var(--text); white-space: nowrap; }

/* Liste görünümü */
.view-list .product-card { flex-direction: row; align-items: stretch; }
.view-list .product-card:hover { transform: none; }
.view-list .product-media { width: 92px; flex: 0 0 92px; aspect-ratio: auto; min-height: 92px; }
.view-list .product-media.no-image { font-size: 1.5rem; }
.view-list .product-media.no-image span, .view-list .img-count { display: none; }
.view-list .product-body { justify-content: center; }
.view-list .product-meta { margin-top: 0; }

/* Yükleniyor iskeleti */
.skeleton .product-media, .skeleton .product-body span { background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; cursor: default; }
.skeleton .product-body span { display: block; height: 12px; border-radius: 6px; }
.skeleton .product-body span:last-child { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.back-to-top { position: fixed; right: 16px; bottom: 16px; z-index: 1030; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--shadow); }

/* Galeri */
.gallery-modal .modal-content { background: #0b0f19; color: #fff; border: 0; border-radius: 20px; overflow: hidden; }
.gallery-header { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; }
.gallery-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-actions { display: flex; gap: 6px; }
.gallery-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; display: grid; place-items: center; font-size: 1.05rem; transition: background .15s; }
.gallery-btn:hover { background: rgba(255, 255, 255, .2); }
.gallery-close { background: #ef4444; }
.gallery-close:hover { background: #dc2626; }
.gallery-swiper { width: 100%; height: min(78vh, 900px); --swiper-navigation-color: #fff; --swiper-pagination-color: #fff; --swiper-navigation-size: 28px; }
.gallery-swiper .swiper-slide { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gallery-swiper .swiper-zoom-container img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.gallery-swiper .swiper-pagination-fraction { background: rgba(0, 0, 0, .5); width: auto; left: 50%; transform: translateX(-50%); padding: 2px 12px; border-radius: 999px; font-size: .8125rem; }
.gallery-hint { text-align: center; font-size: .75rem; color: rgba(255, 255, 255, .55); padding: 8px 12px 12px; }

@media (max-width: 767.98px) {
    .gallery-modal .modal-content { border-radius: 0; }
    .gallery-swiper { height: auto; flex: 1; min-height: 0; }
    .gallery-modal .modal-content { display: flex; flex-direction: column; }
    .gallery-swiper .swiper-button-prev, .gallery-swiper .swiper-button-next { display: none; }
}

@media (max-width: 575.98px) {
    .product-grid.view-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .product-body { padding: 10px; }
    .product-title { font-size: .8125rem; }
    .product-price { font-size: .9375rem; }
    .product-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
    .view-list .product-meta { flex-direction: row; align-items: baseline; }
    .brand-text { font-size: .95rem; }
}

/* =====================================================================
   YÖNETİM PANELİ
   ===================================================================== */

.admin-nav { background: var(--surface); border-bottom: 1px solid var(--border); min-height: var(--header-h); }
.admin-nav .nav-link { color: var(--text-2); font-weight: 500; border-radius: 8px; padding: .5rem .75rem !important; }
.admin-nav .nav-link:hover { color: var(--brand); background: #f8fafc; }
.admin-nav .nav-link.active { color: var(--brand); background: var(--brand-50); }

.stat-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: box-shadow .15s, border-color .15s; height: 100%; }
.stat-card:hover { box-shadow: var(--shadow); border-color: #cbd5e1; color: var(--text); }
.stat-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; }
.stat-value { display: block; font-size: 1.375rem; font-weight: 700; line-height: 1.1; }
.stat-label { display: block; font-size: .8125rem; color: var(--muted); }
.tone-primary .stat-icon { background: var(--brand-50); color: var(--brand); }
.tone-success .stat-icon { background: #ecfdf5; color: #059669; }
.tone-secondary .stat-icon { background: #f1f5f9; color: #475569; }
.tone-warning .stat-icon { background: #fffbeb; color: #d97706; }

.filter-bar { padding: 14px 16px; }

.bulk-bar { position: sticky; top: calc(var(--header-h) + 8px); z-index: 1000; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; background: #1e293b; color: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow); }

.list-head { display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: #fafbfd; }

.product-table { --bs-table-bg: transparent; }
.product-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfd; border-bottom: 1px solid var(--border); padding: 10px 12px; white-space: nowrap; }
.product-table td { padding: 10px 12px; border-color: #f1f5f9; }
.product-table tbody tr:hover { background: #fafcff; }
.product-table tr.is-passive .product-cell { opacity: .55; }
.product-table .col-check { width: 44px; }
.product-table .col-order { width: 110px; }
.product-table .col-order input { max-width: 90px; text-align: center; }
.product-table .col-active { width: 100px; }
.product-table .col-actions { width: 1%; text-align: right; }
.product-table .form-switch .form-check-input { width: 2.6em; height: 1.4em; cursor: pointer; }
.product-table input.is-saving { opacity: .6; }
.product-table input.is-saved { border-color: #10b981; box-shadow: 0 0 0 .2rem rgba(16, 185, 129, .15); }

.product-cell { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.product-cell:hover .product-name { color: var(--brand); }
.thumb { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 10px; overflow: hidden; background: #f1f5f9; display: grid; place-items: center; color: #cbd5e1; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-name { display: block; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.product-sub { display: block; font-size: .75rem; color: var(--muted); }

/* Mobilde tablo satırları kart görünümüne geçer */
@media (max-width: 991.98px) {
    .product-table thead { display: none; }
    .product-table, .product-table tbody, .product-table tr, .product-table td { display: block; width: 100%; }
    .product-table tr { position: relative; padding: 12px 14px 12px 48px; border-bottom: 1px solid var(--border); }
    .product-table td { padding: 4px 0; border: 0; }
    .product-table td.col-check { position: absolute; left: 14px; top: 26px; width: auto; padding: 0; }
    .product-table td.col-product { padding-bottom: 8px; }
    .product-table td[data-label] { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: right !important; }
    .product-table td[data-label]::before { content: attr(data-label); font-size: .8125rem; color: var(--muted); font-weight: 500; text-align: left; }
    .product-table .col-order, .product-table .col-active { width: 100%; }
    .product-table td.col-actions { text-align: left; padding-top: 8px; }
    .product-table td.col-actions .btn { width: 100%; }
}

/* Ürün resimleri */
.product-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.dropzone { display: block; cursor: pointer; text-align: center; padding: 28px 16px; border: 2px dashed #cbd5e1; border-radius: var(--radius); background: var(--surface); transition: all .15s; margin: 0; }
.dropzone:hover, .dropzone.is-dragover { border-color: var(--brand); background: var(--brand-50); }
.dropzone i { font-size: 2.25rem; color: var(--brand); display: block; margin-bottom: 6px; }
.dropzone strong { display: block; color: var(--text); }
.dropzone span span, .dropzone-idle > span { display: block; font-size: .8125rem; color: var(--muted); margin-top: 4px; }
.dropzone-busy { display: none; }
.dropzone.is-busy { pointer-events: none; border-style: solid; }
.dropzone.is-busy .dropzone-idle { display: none; }
.dropzone.is-busy .dropzone-busy { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.image-tile { position: relative; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.image-tile-media { display: block; aspect-ratio: 3 / 4; background: #f1f5f9; }
.image-tile-media img { width: 100%; height: 100%; object-fit: cover; }
.image-tile-actions { display: flex; gap: 6px; padding: 8px; }
.image-tile-actions .js-make-cover { flex: 1; }
.cover-badge { display: none; position: absolute; left: 8px; top: 8px; z-index: 2; background: #f59e0b; color: #fff; font-size: .75rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.image-tile:first-child { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, .25); }
.image-tile:first-child .cover-badge { display: inline-block; }
.image-tile:first-child .js-make-cover { visibility: hidden; }
.drag-handle { position: absolute; right: 8px; top: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .92); box-shadow: var(--shadow-sm); cursor: grab; touch-action: none; font-size: 1.1rem; }
.image-tile.sortable-ghost { opacity: .35; }
.image-tile.sortable-chosen { box-shadow: var(--shadow); }

@media (max-width: 575.98px) {
    .panel-card { padding: 14px; }
    .page-title { font-size: 1.25rem; }
    .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .image-tile-actions .js-make-cover span { display: none; }
    .auth-card { padding: 26px 20px; }
}
