/* ============================================================
   KLEIDCO FATURA ONAY PORTALI — Kurumsal CSS
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Rubik:wght@400;500;600;700;800&display=swap');

:root {
  --primary:       #1a2332;
  --primary-light: #243447;
  --accent:        #3d5a80;      /* mavi-gri, yumuşak */
  --accent-hover:  #2c4464;
  --success:       #16a34a;
  --danger:        #dc2626;
  --warning:       #d97706;
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --border-dark:   #cbd5e1;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:        0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:     0 10px 25px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.08);
  --radius:        8px;
  --radius-sm:     5px;
  --radius-lg:     12px;
  --navbar-h:      56px;
  --transition:    all .18s ease;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: auto; }   /* yatay scroll sayfada, navbar'da değil */

body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--navbar-h);   /* fixed navbar için boşluk */
}

/* ============================================================
   NAVBAR — fixed, her zaman en üstte, yatay scroll yapmaz
   ============================================================ */
.navbar {
  position: fixed;              /* fixed: scroll'dan etkilenmez */
  top: 0;
  left: 0;
  right: 0;                     /* sağa da uzanır */
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  height: var(--navbar-h);
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  min-width: 0;                 /* taşmayı önle */
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.navbar-brand img { height: 32px; width: auto; mix-blend-mode: screen; }

.navbar-title {
  font-size: 17px;
  font-weight: 700;
  font-family: 'Rubik', 'Inter', sans-serif;
  color: #fff;
  letter-spacing: .2px;
  white-space: nowrap;
}

.navbar-title span { color: #d1d5db; }  /* açık gri */

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.navbar-nav a {
  color: #94a3b8;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.navbar-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.navbar-nav a.active {
  color: #fff;
  background: var(--accent);
}

.navbar-nav a[href="Logout.php"] {
  color: #fca5a5;
  font-weight: 600;
}
.navbar-nav a[href="Logout.php"]:hover {
  color: #fff;
  background: rgba(220,38,38,.3);
}

.nav-sep {
  color: #334155;
  margin: 0 4px;
  user-select: none;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  font-size: 13px;
  padding-left: 14px;
  border-left: 1px solid #334155;
  margin-left: 8px;
  white-space: nowrap;
}

.navbar-user strong { color: #fff; }

/* ============================================================
   TOOLBAR (filtre formu)
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.toolbar label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.toolbar select,
.toolbar input[type="text"],
.toolbar input[type="date"] {
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}

.toolbar select:focus,
.toolbar input[type="text"]:focus,
.toolbar input[type="date"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61,90,128,.15);
}

.radio-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  flex-wrap: wrap;
}

.radio-group input[type="radio"] { accent-color: #6b7280; cursor: pointer; }

.radio-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  padding-right: 8px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
button, .btn {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

button { background: var(--accent); color: #fff; }
button:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow); }

/* Sadece ikon içeren butonlar — küçük, nötr */
button:has(> img) {
  background: transparent !important;
  border: 1px solid #cbd5e1 !important;
  color: #64748b !important;
  padding: 3px 5px !important;
  box-shadow: none !important;
  transform: none !important;
  line-height: 0;
}
button:has(> img):hover {
  background: #f1f5f9 !important;
  transform: none !important;
  box-shadow: none !important;
}
button:has(> img) > img { height: 16px; width: auto; display: block; }

button[style*="background-color:green"],
button[style*="background-color: green"] {
  background: var(--success) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 3px rgba(22,163,74,.3) !important;
}
button[style*="background-color:green"]:hover,
button[style*="background-color: green"]:hover {
  background: #15803d !important;
  transform: translateY(-1px);
}

button[style*="background-color:red"],
button[style*="background-color: red"] {
  background: var(--danger) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 3px rgba(220,38,38,.3) !important;
}
button[style*="background-color:red"]:hover,
button[style*="background-color: red"]:hover {
  background: #b91c1c !important;
  transform: translateY(-1px);
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
#filtre {
  background: var(--primary-light) !important;
  padding: 8px 20px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

#searchInput {
  border: 1px solid #334155;
  background: rgba(255,255,255,.07);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-family: inherit;
  width: 220px;
  outline: none;
  transition: var(--transition);
}
#searchInput:focus {
  border-color: #9ca3af;
  background: rgba(255,255,255,.12);
  box-shadow: 0 0 0 3px rgba(156,163,175,.2);
}
#searchInput::placeholder { color: #64748b; }

#turFilter {
  border: 1px solid #334155;
  background: #374151;
  color: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  color-scheme: dark;
}
#turFilter:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px rgba(156,163,175,.2);
}
#turFilter option { background: #374151; color: #f1f5f9; }

/* ============================================================
   TABLE
   ============================================================ */
table:not(.ui-datepicker-calendar) {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  background: var(--surface);
}

thead:not(.ui-datepicker-calendar thead) th,
.lfloatthead th {
  background: #4b5563 !important;
  color: #f3f4f6 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: .2px !important;
  padding: 6px 4px !important;
  border: none !important;
  border-right: 1px solid #6b7280 !important;
  white-space: normal !important;
  overflow: visible !important;
  vertical-align: bottom !important;
  word-break: break-word !important;
}

thead th:last-child,
.lfloatthead th:last-child { border-right: none !important; }

/* floatThead klon satırları da aynı rengi alsın */
.floatThead-container thead th { background: #4b5563 !important; }

/* datepicker th'larını sıfırla */
.ui-datepicker table thead th,
.ui-datepicker-calendar thead th {
  background: none !important;
  color: inherit !important;
  font-size: inherit !important;
  font-weight: bold !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 2px !important;
  border: none !important;
  border-right: none !important;
  white-space: normal;
}

tbody:not(.ui-datepicker-calendar tbody) tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody:not(.ui-datepicker-calendar tbody) tr:hover { background: #dde3ea !important; }
tbody:not(.ui-datepicker-calendar tbody) tr:nth-child(even) { background: #f8fafc; }
tbody:not(.ui-datepicker-calendar tbody) tr:nth-child(even):hover { background: #dde3ea !important; }

tbody:not(.ui-datepicker-calendar tbody) td {
  padding: 7px 8px !important;
  border: none !important;
  border-right: 1px solid var(--border) !important;
  color: var(--text);
  vertical-align: middle;
}
tbody:not(.ui-datepicker-calendar tbody) td:last-child { border-right: none !important; }

/* datepicker — tüm override sıfırlama */
.ui-datepicker td {
  padding: 1px !important;
  border: none !important;
  border-right: none !important;
  background: none !important;
  width: auto !important;
}
.ui-datepicker tr {
  border-bottom: none !important;
  background: none !important;
}
.ui-datepicker tr:hover {
  background: none !important;
}
.ui-datepicker td a,
.ui-datepicker td span {
  display: block;
  padding: 2px 4px;
  text-align: center;
}

/* Tablo içi fatura no linkleri */
tbody td > a {
  color: #3d5a80;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px solid #c5d2e0;
}
tbody td > a:hover {
  color: #2c4464;
  border-bottom-color: #2c4464;
}

/* Durum renkleri */
td[style*="background-color:lightgreen"],
td[style*="background-color: lightgreen"] {
  background: #dcfce7 !important;
  color: #15803d !important;
  font-weight: 600;
}
td[style*="background-color:red"],
td[style*="background-color: red"] {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  font-weight: 600;
}
td[style*="background-color:yellow"],
td[style*="background-color: yellow"] {
  background: #fef9c3 !important;
  color: #92400e !important;
  font-weight: 600;
}
td[style*="background-color:green"],
td[style*="background-color: green"] {
  background: #dcfce7 !important;
  color: #15803d !important;
  font-weight: 600;
}

/* ============================================================
   JQUERY UI DIALOG (Modal) — ekrana sığdır
   ============================================================ */
/* Modal açıldığında arka plan yarı saydam siyah */
.ui-widget-overlay {
  background: rgba(0, 0, 0, 0.6) !important;
  opacity: 1 !important;
}

.ui-dialog {
  border-radius: var(--radius-lg) !important;
  border: none !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 8px 20px rgba(0,0,0,.2) !important;
  overflow: visible !important;   /* taşıma/kapatma için visible */
  max-width: calc(100vw - 20px) !important;
  max-height: calc(100vh - 20px) !important;
}

.ui-dialog-titlebar {
  background: var(--primary) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 12px 16px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  font-family: 'Inter', sans-serif !important;
}

.ui-dialog-titlebar .ui-dialog-title { color: #fff !important; }

.ui-dialog-titlebar-close {
  background: transparent !important;
  border: none !important;
}

.ui-dialog-titlebar-close .ui-icon {
  background-color: #94a3b8 !important;
}

.ui-dialog-content {
  padding: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  /* navbar yüksekliğini çıkar */
  max-height: calc(100vh - var(--navbar-h) - 80px) !important;
}

/* ============================================================
   FATURA AKSİYON ALANI
   ============================================================ */
#aksiyon {
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Onay span'ları */
span[style*="padding: 4px"] {
  border-radius: 4px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 3px 10px !important;
}

/* ============================================================
   FOOTER STATS
   ============================================================ */
hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
#filtre_l { font-weight: 700; color: var(--accent); }

/* ============================================================
   BEKLEYEN İŞLEM
   ============================================================ */
#bekleyendiv {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
}

#bekleyenislem {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   LOGIN SAYFASI
   ============================================================ */
body.login-page,
body:has(> .login-card) {
  background: linear-gradient(135deg, #1a2332 0%, #1e3a5f 50%, #0f172a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.2);
  width: 400px;
  overflow: hidden;
}

.login-header {
  background: #2d2d2d;
  padding: 32px 40px 28px;
  text-align: center;
  border-bottom: 2px solid rgba(255,255,255,0.08);
}

.login-header img { height: 44px; width: auto; margin-bottom: 16px; filter: brightness(0) invert(1); }
.login-header h1 { font-size: 20px; font-weight: 800; font-family: 'Rubik', sans-serif; color: #fff; letter-spacing: -.2px; margin-bottom: 4px; }
.login-header p  { font-size: 12px; color: #64748b; }

.login-body { padding: 36px 40px 28px; }

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 7px;
}

.form-group input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
}

.form-group input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}

.form-group input::placeholder { color: #94a3b8; }

.btn-login {
  display: block;
  width: 100%;
  height: 46px;
  background: #2d8653;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Rubik', 'Inter', sans-serif;
  cursor: pointer;
  letter-spacing: .3px;
  transition: var(--transition);
  margin-top: 8px;
}

.btn-login:hover {
  background: #236b42;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(45,134,83,.4);
}

.login-footer {
  background: #f8fafc;
  border-top: 1px solid var(--border);
  padding: 14px 40px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  min-height: 40px;
}

.error-msg { color: #dc2626; font-weight: 500; font-size: 13px; }

/* ============================================================
   TABLO EKrana SIĞDIRMA
   ============================================================ */

/* Tablo container — yatay scroll SADECE tablo için, navbar etkilenmesin */
.tablo-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Ana liste tablosu */
#tablo {
  width: 100%;
  table-layout: fixed;     /* kolonlar sabit genişlikte */
  font-size: 12px;
  border-collapse: collapse;
}

#tablo thead th,
.floatThead-container th,
.floatThead-table th {
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 0 !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  vertical-align: bottom !important;
}

/* th içindeki span — tam metin, satır kaydırmalı */
#tablo thead th > span,
.floatThead-container th > span,
.floatThead-table th > span {
  display: block !important;
  padding: 6px 4px !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.3 !important;
}

#tablo tbody td {
  padding: 6px 5px !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;            /* ellipsis için gerekli */
  font-size: 12px;
}

/* Kolon genişlikleri — toplam ~100% */
#tablo .l0  { width: 3%; }      /* Sıra */
#tablo .l1  { width: 6%; }      /* Tarih */
#tablo .l2  { width: 5%; }      /* Key */
#tablo th:nth-child(4),
#tablo td:nth-child(4) {
  width: 10%;               /* Fatura No — tam gösterim */
  overflow: visible !important;
  text-overflow: unset !important;
  white-space: nowrap !important;
  max-width: none !important;
}
#tablo .l3  { width: 12%; }     /* Cari Unvan */
#tablo .l4  { width: 7%; }      /* Tutar */
#tablo .l5  { width: 4%; }      /* Türü */
#tablo .l30 { width: 7%; }      /* Onay 1 */
#tablo .l6  { width: 7%; }      /* Onay 2 */
#tablo .l7  { width: 7%; }      /* Kesin Onay */
#tablo .l8  { width: 5%; }      /* DIA Durum */
#tablo .l9  { width: 3%; }      /* AS USD */
#tablo .l10 { width: 3%; }      /* VS USD */
#tablo .l11 { width: 3%; }      /* Sip. Kar */
#tablo .l12 { width: 4%; }      /* Sip. Kar % */
#tablo .l99 { width: 4%; }      /* AS/AF Kar % */
#tablo .l13 { width: 4%; }      /* AF USD */
#tablo .l14 { width: 4%; }      /* SF USD */
#tablo .l15 { width: 4%; }      /* Fat. Kar */
#tablo .l16 { width: 4%; }      /* Fat. Kar % */
#tablo .l17 { width: 4%; }      /* Sevk */
#tablo .l18 { width: 4%; }      /* Fat. Durum */
#tablo .l19 { width: 4%; }      /* Sip. Durum */
#tablo .l20 { width: 7%; }      /* Açıklama (OnayListesi) */
#tablo .l21 { width: 8%; }      /* Aksiyon (OnayListesi) */

/* Tooltip: üzerine gelince tam metni göster */
#tablo tbody td[title] { cursor: default; }

/* Cari unvan kolonu — biraz daha okunur */
#tablo .l3 { font-weight: 500; }

/* Sayısal kolonlar sağa hizala */
#tablo .l4, #tablo .l9, #tablo .l10,
#tablo .l11, #tablo .l12, #tablo .l99,
#tablo .l13, #tablo .l14, #tablo .l15,
#tablo .l16 { text-align: right; }

/* Onay butonları tablo içinde sıkıştır */
#tablo .l21 button {
  font-size: 10px !important;
  padding: 3px 6px !important;
  margin: 1px !important;
  white-space: nowrap;
}

/* floatThead — z-index yeterli, top plugin tarafından transform ile yönetiliyor */
.floatThead-container {
  z-index: 9998;
}
