/* products.css - dashboard.css uzerine eklenir */

/* ARAMA KUTUSU */
#searchInput {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #1f2937;
    background: #f9fafb;
    width: 280px;
}

#searchInput:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
}

body.dark #searchInput {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark #searchInput:focus {
    border-color: #3b82f6;
    background: #1e293b;
}

/* ============================================================
   FILTRE CUBUGU
   ============================================================ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    background: white;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.filter-bar label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4b5563;
}

.filter-bar select,
.filter-bar input[type="number"] {
    padding: 5px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #1f2937;
    background: #f9fafb;
    width: 90px;
}

.filter-bar select { width: auto; }

.filter-bar button {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.filter-bar button:hover { background: #2563eb; }

.filter-bar .btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.filter-bar .btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.products-count {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.products-update {
    font-size: 11px;
    color: #9ca3af;
    margin-left: 4px;
}

/* ============================================================
   SIRALALANABILIR TABLO BASLIKLARI
   ============================================================ */
.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover { background: #f3f4f6; }

.sort-icon {
    display: inline-block;
    width: 12px;
    font-size: 10px;
    color: #3b82f6;
}

/* ============================================================
   YATAY KAYDIR
   ============================================================ */
.table-wrapper { overflow-x: auto; }

.problem-reason {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   MARJ DUZENLEME
   ============================================================ */
.margin-cell {
    white-space: nowrap;
}

.margin-display {
    font-size: 13px;
    color: #374151;
    min-width: 36px;
    display: inline-block;
}

.margin-edit {
    display: none;
    align-items: center;
    gap: 4px;
}

.margin-edit input {
    width: 70px;
    padding: 3px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
}

.btn-save {
    padding: 3px 8px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.btn-save:hover { background: #059669; }

.btn-cancel {
    padding: 3px 8px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.btn-cancel:hover { background: #e5e7eb; }

.btn-margin-edit {
    padding: 3px 8px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    margin-left: 4px;
    transition: all 0.15s;
}

.btn-margin-edit:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* ============================================================
   DARK MODE
   ============================================================ */
body.dark .filter-bar {
    background: #1e293b;
    border-color: #334155;
}

body.dark .filter-bar label { color: #94a3b8; }

body.dark .filter-bar select,
body.dark .filter-bar input[type="number"] {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark .filter-bar .btn-secondary {
    background: #1e293b;
    color: #cbd5e1;
    border-color: #475569;
}

body.dark .filter-bar .btn-secondary:hover {
    background: #334155;
}

body.dark .products-count { color: #e2e8f0; }

body.dark .sortable:hover { background: #1e293b; }

body.dark .margin-display { color: #cbd5e1; }

body.dark .margin-edit input {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark .btn-cancel {
    background: #1e293b;
    color: #94a3b8;
    border-color: #475569;
}

body.dark .btn-cancel:hover { background: #334155; }

body.dark .btn-margin-edit {
    background: #1e293b;
    color: #94a3b8;
    border-color: #475569;
}

body.dark .btn-margin-edit:hover { background: #334155; }

/* GUNCELLE BUTONU */
.btn-refresh {
    padding: 3px 10px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 4px;
    transition: background 0.15s;
}

.btn-refresh:hover          { background: #2563eb; }
body.dark .btn-refresh      { background: #2563eb; }
body.dark .btn-refresh:hover { background: #1d4ed8; }

/* SIL BUTONU */
.btn-delete {
    padding: 3px 10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-delete:hover          { background: #dc2626; }
body.dark .btn-delete      { background: #b91c1c; }
body.dark .btn-delete:hover { background: #991b1b; }

/* ============================================================
   BULK TOOLBAR
   ============================================================ */
#bulkToolbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 10px;
}

#bulkToolbar #selectedCount {
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
}

#bulkToolbar button {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

#bulkRefreshBtn {
    background: #3b82f6;
    color: white;
    margin-right: 8px;
}

#bulkRefreshBtn:hover { background: #2563eb; }

#bulkDeleteBtn {
    background: #ef4444;
    color: white;
}

#bulkDeleteBtn:hover { background: #dc2626; }

body.dark #bulkToolbar {
    background: #292524;
    border-color: #a16207;
}

body.dark #bulkToolbar #selectedCount { color: #fcd34d; }

body.dark #bulkRefreshBtn { background: #2563eb; }
body.dark #bulkRefreshBtn:hover { background: #1d4ed8; }
body.dark #bulkDeleteBtn { background: #b91c1c; }
body.dark #bulkDeleteBtn:hover { background: #991b1b; }

/* Çoklu seçim: checkbox tıklama alanını genişlet (layout'u kaydırmadan) */
.cb-hit { display: inline-flex; align-items: center; justify-content: center; padding: 8px; margin: -8px; cursor: pointer; }

/* CHECKBOX */
.row-select,
#selectAll {
    cursor: pointer;
    width: 15px;
    height: 15px;
}

#products-tbody tr.row-selected {
    background: #eff6ff;
}

body.dark #products-tbody tr.row-selected {
    background: #1e3a5f;
}

/* PAGINATION */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 0.875rem;
    color: #6b7280;
    min-width: 140px;
    font-variant-numeric: tabular-nums;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: transparent;
    color: #374151;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
    user-select: none;
}

.page-btn:hover:not(:disabled):not(.active) {
    border-color: #22d3ee;
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.07);
}

.page-btn.active {
    background: #22d3ee;
    border-color: #22d3ee;
    color: #0f172a;
    font-weight: 700;
    cursor: default;
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ‹ › nav butonlari biraz daha buyuk karakter */
.page-nav-btn {
    font-size: 1.15rem;
    line-height: 1;
}

.page-ellipsis {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #9ca3af;
    cursor: default;
    user-select: none;
    letter-spacing: 0.05em;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #6b7280;
}

.pagination-size select {
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: transparent;
    color: #374151;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    appearance: auto;
}

.pagination-size select:focus {
    border-color: #22d3ee;
}

/* DARK MODE */
body.dark .pagination-bar { border-top-color: #1e293b; }
body.dark .pagination-info { color: #94a3b8; }

body.dark .page-btn {
    border-color: #334155;
    color: #cbd5e1;
}
body.dark .page-btn:hover:not(:disabled):not(.active) {
    border-color: #22d3ee;
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.09);
}
body.dark .page-btn.active {
    background: #22d3ee;
    border-color: #22d3ee;
    color: #0f172a;
}
body.dark .page-ellipsis { color: #475569; }

body.dark .pagination-size { color: #94a3b8; }
body.dark .pagination-size select {
    border-color: #334155;
    color: #cbd5e1;
    background: #0f172a;
}
body.dark .pagination-size select:focus { border-color: #22d3ee; }

/* MOBILE */
@media (max-width: 768px) {
    .filter-bar { gap: 8px; padding: 10px 12px; }
    .filter-bar select,
    .filter-bar input[type="number"] { width: 80px; }
    .pagination-bar { padding: 12px 16px; justify-content: center; }
    .pagination-info { min-width: unset; width: 100%; text-align: center; }
    .pagination-size { width: 100%; justify-content: center; }
}

/* ============================================================
   SENKRONIZE ET BUTONU
   ============================================================ */
.btn-sync-listing {
    background: transparent;
    color: #0d9488;
    border: 1.5px solid #0d9488;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-sync-listing:hover {
    background: #0d9488;
    color: white;
}

.btn-sync-listing:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

body.dark .btn-sync-listing {
    color: #2dd4bf;
    border-color: #2dd4bf;
}

body.dark .btn-sync-listing:hover {
    background: #2dd4bf;
    color: #0f172a;
}

/* ============================================================
   SENKRONIZASYON MODAL
   ============================================================ */
.sync-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.sync-modal {
    background: white;
    border-radius: 12px;
    padding: 28px 32px;
    width: 460px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.sync-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 18px 0;
}

.sync-modal-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.sync-stat {
    font-size: 14px;
    color: #374151;
}

.sync-stat-delete {
    color: #dc2626;
    font-weight: 600;
}

.sync-modal-sample {
    margin-bottom: 14px;
    max-height: 200px;
    overflow-y: auto;
}

.sync-sample-list {
    font-size: 12px;
    font-family: monospace;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 10px;
}

.sync-sample-item {
    padding: 2px 0;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

.sync-sample-item:last-child { border-bottom: none; }

.sync-sample-more {
    padding: 4px 0 0 0;
    color: #6b7280;
    font-size: 11px;
    font-style: italic;
}

.sync-no-delete {
    font-size: 14px;
    color: #059669;
    margin: 0;
}

.sync-modal-warning {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #dc2626;
    font-weight: 500;
    margin-bottom: 20px;
}

.sync-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-cancel-sync {
    padding: 8px 20px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-cancel-sync:hover { background: #e5e7eb; }

.btn-confirm-sync {
    padding: 8px 22px;
    background: transparent;
    color: #dc2626;
    border: 1.5px solid #dc2626;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-confirm-sync:hover {
    background: #dc2626;
    color: white;
}

.btn-confirm-sync:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Dark mode modal */
body.dark .sync-modal {
    background: #1e293b;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark .sync-modal-title { color: #f1f5f9; }
body.dark .sync-stat { color: #cbd5e1; }
body.dark .sync-stat-delete { color: #f87171; }

body.dark .sync-sample-list {
    background: #0f172a;
    border-color: #334155;
}

body.dark .sync-sample-item {
    color: #cbd5e1;
    border-color: #1e293b;
}

body.dark .sync-sample-more { color: #64748b; }
body.dark .sync-no-delete { color: #34d399; }

body.dark .sync-modal-warning {
    background: rgba(220, 38, 38, 0.12);
    border-color: #991b1b;
    color: #f87171;
}

body.dark .btn-cancel-sync {
    background: #334155;
    color: #cbd5e1;
    border-color: #475569;
}

body.dark .btn-cancel-sync:hover { background: #475569; }

body.dark .btn-confirm-sync {
    color: #f87171;
    border-color: #f87171;
}

body.dark .btn-confirm-sync:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

/* ============================================================
   TOAST BİLDİRİMİ
   ============================================================ */
.sync-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 2000;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s, transform 0.25s;
    max-width: 380px;
}

.sync-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.sync-toast-success {
    background: #059669;
    color: white;
}

.sync-toast-error {
    background: #dc2626;
    color: white;
}

.sync-toast-info {
    background: #0369a1;
    color: white;
}

/* "Yeni" rozeti — son 3 saatte yayinlanan urun (NEW_BADGE_HOURS=3) */
.badge-new {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .3px;
    background: #22d3ee;
    color: #083344;
    vertical-align: middle;
}
.row-new td { background: rgba(34, 211, 238, .06); }
