:root {
  --bg-color: #0f172a;
  --bg-gradient: radial-gradient(circle at top left, #1e293b, #0f172a 60%);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --card-radius: 24px;
  --sidebar-width: 260px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography */
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 4px; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { font-size: 1rem; color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; color: var(--text-secondary); }

/* Utilities */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--card-radius);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 16px;
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary { background: var(--primary); color: #0f172a; box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6); }
.btn-block { width: 100%; }

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  cursor: pointer;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: 0.3s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); transform: rotate(5deg); }

.badge {
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-unit { background: rgba(56, 189, 248, 0.15); color: var(--primary); border: 1px solid rgba(56, 189, 248, 0.3); }

/* Forms */
.input-group {
  position: relative;
  margin-bottom: 20px;
  width: 100%;
}
.input-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.input-group .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}
.input-group input, .input-group select {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  padding: 16px;
  border-radius: 16px;
  color: white;
  font-size: 1rem;
  outline: none;
  transition: 0.3s;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.input-group .icon ~ input, .input-group .icon ~ select {
  padding-left: 48px;
}
.input-group input:focus, .input-group select:focus { border-color: var(--primary); background: rgba(15, 23, 42, 0.8); box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1); }
select option {
  background: #0f172a;
  color: white;
  padding: 12px;
}

/* Screens Fix */
.screen { display: none; opacity: 0; transition: opacity 0.4s ease; }
.screen.active { display: block; opacity: 1; }

/* Login Screen */
#login-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(56,189,248,0.1) 0%, transparent 60%);
  z-index: -1; pointer-events: none;
}
.logo-circle {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.05));
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  color: var(--primary);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.2);
}
.logo-circle span { font-size: 40px; }
.login-header { margin-bottom: 40px; }

/* App Layout */
#app-screen {
  display: none;
}
#app-screen.active {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* App Header */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.user-name { font-weight: 500; }

/* Content */
.app-content {
  padding: 32px 24px;
  padding-bottom: 100px; /* Space for bottom nav */
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.tab-content { display: none; animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.tab-content.active { display: block; }

@keyframes slideUp { 
  from { opacity: 0; transform: translateY(20px); } 
  to { opacity: 1; transform: translateY(0); } 
}

.page-header { margin-bottom: 32px; display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; }

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.kpi-card { padding: 24px; display: flex; align-items: center; gap: 20px; transition: transform 0.3s; cursor: default; }
.kpi-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,0.2); }
.kpi-icon {
  width: 64px; height: 64px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center; font-size: 32px;
}
.kpi-icon.blue { background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.05)); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.2); }
.kpi-icon.red { background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.05)); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.kpi-icon.orange { background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05)); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }
.kpi-icon.green { background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05)); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }

.kpi-label { font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.kpi-value { font-size: 2rem; margin-top: 6px; font-weight: 700; background: linear-gradient(to right, #fff, #cbd5e1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Table Container */
.table-container { width: 100%; overflow-x: auto; border-radius: var(--card-radius); padding: 4px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 800px; }
th, td { padding: 18px 24px; text-align: left; border-bottom: 1px solid var(--glass-border); }
th { color: var(--text-secondary); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Bottom Nav (Mobile) */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; width: 100%;
  display: flex; justify-content: space-around;
  padding: 12px 0 16px; border-top: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 40;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-decoration: none; color: var(--text-secondary);
  font-size: 0.75rem; font-weight: 600; transition: 0.3s;
  padding: 8px 16px; border-radius: 12px;
}
.nav-item span.material-symbols-rounded { font-size: 26px; transition: 0.3s; }
.nav-item.active { color: var(--primary); background: rgba(56, 189, 248, 0.1); }
.nav-item.active span.material-symbols-rounded { transform: translateY(-2px); }

/* Sidebar (Desktop) */
.sidebar { display: none; }

@media (min-width: 1024px) {
  .bottom-nav { display: none; }
  
  #app-screen.active { flex-direction: row; }
  
  .sidebar {
    display: flex; flex-direction: column;
    width: var(--sidebar-width);
    height: 100vh; position: sticky; top: 0;
    background: rgba(15, 23, 42, 0.4);
    border-right: 1px solid var(--glass-border);
    padding: 32px 24px;
    z-index: 40;
  }
  
  .sidebar-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; }
  .sidebar-logo span { font-size: 32px; color: var(--primary); }
  .sidebar-logo h2 { font-size: 1.25rem; font-weight: 700; }
  
  .sidebar-nav { display: flex; flex-direction: column; gap: 8px; flex: 1; }
  .sidebar-nav .nav-item {
    flex-direction: row; justify-content: flex-start; gap: 16px;
    padding: 16px 20px; font-size: 1rem;
  }
  .sidebar-nav .nav-item span.material-symbols-rounded { font-size: 24px; }
  
  .app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
  .app-header { background: transparent; border-bottom: none; padding: 32px; padding-bottom: 0; }
  .header-left h2 { display: none; } /* Hide logo in header for desktop */
  .app-content { padding: 32px; padding-bottom: 32px; }
}

/* Modals */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100; display: none; opacity: 0; transition: 0.4s;
}
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -40%) scale(0.95);
  width: 90%; max-width: 500px;
  border-radius: var(--card-radius); z-index: 101;
  display: none; opacity: 0; transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 32px;
}
.modal.active, .modal-overlay.active { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-overlay.active { transform: none; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }

/* Toast */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px) scale(0.9);
  background: var(--text-primary); color: var(--bg-color); padding: 14px 28px;
  border-radius: 30px; font-weight: 600; font-size: 1rem;
  opacity: 0; pointer-events: none; transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1); z-index: 1000;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
@media (min-width: 1024px) { .toast { bottom: 40px; } }

/* Responsive Tables for Mobile */
@media (max-width: 768px) {
  table, thead, tbody, th, td, tr { display: block; }
  thead tr { display: none; }
  table { min-width: 0; }
  .table-container { background: none; border: none; padding: 0; }
  tr { 
    margin-bottom: 15px; 
    border-radius: 12px; 
    padding: 15px; 
    background: rgba(255,255,255,0.03); 
    border: 1px solid rgba(255,255,255,0.08);
  }
  td { 
    position: relative; 
    padding: 10px 0 10px 45%; 
    text-align: right; 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    min-height: 40px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }
  td:last-child { border-bottom: none; }
  td::before { 
    position: absolute; 
    left: 0; 
    width: 40%; 
    padding-right: 10px; 
    text-align: left; 
    font-weight: 600; 
    color: var(--text-secondary);
    font-size: 0.85rem;
  }
  
  /* Table Diffs labels */
  #table-diffs td:nth-child(1)::before { content: "Tarih"; }
  #table-diffs td:nth-child(2)::before { content: "Müşteri"; }
  #table-diffs td:nth-child(3)::before { content: "Ürün"; }
  #table-diffs td:nth-child(4)::before { content: "Liste"; }
  #table-diffs td:nth-child(5)::before { content: "Verilen"; }
  #table-diffs td:nth-child(6)::before { content: "Adet"; }
  #table-diffs td:nth-child(7)::before { content: "Fark(₺)"; }
  #table-diffs td:nth-child(8)::before { content: "Durum"; }
  #table-diffs td:nth-child(9)::before { content: "İşlem"; }

  /* Table Staff labels */
  #table-staff td:nth-child(1)::before { content: "Ad Soyad"; }
  #table-staff td:nth-child(2)::before { content: "Kullanıcı Adı"; }
  #table-staff td:nth-child(3)::before { content: "Yetki"; }
  #table-staff td:nth-child(4)::before { content: "Durum"; }
  #table-staff td:nth-child(5)::before { content: "İşlem"; }
}
