/* ═══════════════════════════════════════════════
   ProGaraj — Ana Stil Dosyası
   Tüm renkler buradan yönetilir
═══════════════════════════════════════════════ */

/* ── RENK PALETİ ─────────────────────────────── */
[data-theme="dark"] {
  --bg:            #050505; /* Saf siyaha yakın daha koyu arka plan */
  --bg-card:       #121212; /* Daha belirgin kart rengi */
  --bg-input:      #1a1a1a;
  --bg-sidebar:    #0d0d0d;
  --bg-hover:      #1e1e1e;
  --text:          #f4f4f4;
  --text-muted:    #888888;
  --text-sidebar:  #cccccc;
  --border:        #262626;
  --border-green:  rgba(125,200,50,0.25);
  --primary:       #7DC832;
  --primary-dark:  #5a9e1f;
  --primary-glow:  rgba(125,200,50,0.15);
  --primary-text:  #0a0a0a;
  --danger:        #ef4444;
  --danger-bg:     rgba(239,68,68,0.1);
  --warning:       #f59e0b;
  --warning-bg:    rgba(245,158,11,0.1);
  --info:          #3b82f6;
  --info-bg:       rgba(59,130,246,0.1);
  --success:       #7DC832;
  --success-bg:    rgba(125,200,50,0.1);
  --shadow:        rgba(0,0,0,0.6);
  --overlay:       rgba(0,0,0,0.8);
}

[data-theme="light"] {
  --bg:            #f3f5f3; /* Daha grimsi arka plan */
  --bg-card:       #ffffff; /* Saf beyaz kartlar */
  --bg-input:      #f8faf8;
  --bg-sidebar:    #111111;
  --bg-hover:      #f0f0f0;
  --text:          #1a1a1a;
  --text-muted:    #666666;
  --text-sidebar:  #dddddd;
  --border:        #e0e0e0;
  --border-green:  rgba(90,158,31,0.3);
  --primary:       #5a9e1f;
  --primary-dark:  #4a8a12;
  --primary-glow:  rgba(90,158,31,0.1);
  --primary-text:  #ffffff;
  --danger:        #dc2626;
  --danger-bg:     rgba(220,38,38,0.08);
  --warning:       #d97706;
  --warning-bg:    rgba(217,119,6,0.08);
  --info:          #2563eb;
  --info-bg:       rgba(37,99,235,0.08);
  --success:       #5a9e1f;
  --success-bg:    rgba(90,158,31,0.08);
  --shadow:        rgba(0,0,0,0.1);
  --overlay:       rgba(0,0,0,0.5);
}

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

html, body { 
  width: 100%; 
  max-width: 100vw; 
  overflow-x: hidden; 
  margin: 0; 
  padding: 0; 
  position: relative;
}

html { 
  font-size:16px; 
  -webkit-text-size-adjust: 100%; 
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── LAYOUT ──────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 2100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo img { height: 44px; width: auto; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--text-sidebar);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(125,200,50,0.12); color: var(--primary); border-left-color: var(--primary); }
.nav-item svg { flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }

.nav-section {
  padding: 16px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
}

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.07); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--primary-text); flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 11px; color: rgba(255,255,255,0.4); }

/* ── MAIN CONTENT ────────────────────────────── */
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - 240px);
}

/* ── TOPBAR ──────────────────────────────────── */
.topbar {
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 500;
}

.topbar-title { font-size: 18px; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

.burger {
  display: none;
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
}

/* ── PAGE BODY ───────────────────────────────── */
.page-body { padding: 24px; flex: 1; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── KARTLAR ─────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; color: var(--text); display: flex; align-items: center; justify-content: space-between; }

/* ── TABLO ───────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: var(--bg-input); color: var(--text-muted); font-weight: 600; font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; padding: 12px 16px; text-align: left; white-space: nowrap; }
tbody tr { border-top: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 13px 16px; color: var(--text); vertical-align: middle; }

/* ── BUTONLAR ────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 10px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; transition: all 0.2s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.badge-active { background: var(--success-bg) !important; color: var(--success) !important; border-color: var(--success) !important; }
.badge-waiting { background: var(--warning-bg) !important; color: var(--warning) !important; border-color: var(--warning) !important; }
.badge-waiting-parts { background: rgba(168, 85, 247, 0.1) !important; color: #a855f7 !important; border-color: rgba(168, 85, 247, 0.3) !important; }
.badge-done { background: var(--info-bg) !important; color: var(--info) !important; border-color: var(--info) !important; }
.badge-cancelled { background: var(--danger-bg) !important; color: var(--danger) !important; border-color: var(--danger) !important; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

/* ── FORM ────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; }
input, select, textarea { width: 100%; background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; font-size: 13px; color: var(--text); outline: none; transition: border-color 0.2s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

/* ── MOBİL ───────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); visibility: hidden; }
  .sidebar.open { transform: translateX(0); visibility: visible; box-shadow: 4px 0 20px var(--shadow); }
  .main-content { margin-left: 0; width: 100%; min-width: 100%; }
  .topbar { padding: 0 16px; width: 100%; }
  .burger { display: flex; }
  .page-body { padding: 12px; padding-bottom: 80px; width: 100%; }
  .app-layout { display: block; width: 100%; }

  /* Tablo gizle, kart göster */
  #orders-table { display: none !important; }
  .stat-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    padding: 0 5px;
  }
  .stat-card {
    padding: 12px 8px !important;
    flex-direction: column !important;
    text-align: center;
  }
  .stat-icon { display: none !important; } /* Yer kazanmak için mobilde ikonları gizle */
  .stat-value { font-size: 13px !important; }
  .stat-label { font-size: 10px !important; }
  #orders-cards { 
    display: grid !important; 
    grid-template-columns: 1fr 1fr !important; /* 2 tane yan yana */
    gap: 8px !important; 
    padding: 8px !important; 
    width: 100% !important;
  }
  
  .order-card { 
    margin-bottom: 0 !important; 
    padding: 10px !important; 
    min-width: 0 !important;
  }
  .order-card-body { display: block; } /* 2'li kolonda dikey dizilim daha iyi */
  .order-card-row { margin-bottom: 6px; }
  .order-card-val { font-size: 11px; }
  .plate { font-size: 11px; padding: 2px 5px; }

  /* Modal ortalanmış tam genişlik */
  .modal-overlay { padding: 12px; align-items: center; }
  .modal {
    margin: 0; max-width: 100% !important; width: 100%;
    border-radius: 16px;
    max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .modal .flex { flex-wrap: nowrap; }
  .modal .flex > input { min-width: 0; flex: 1; }
  .modal [style*="grid-template-columns:1fr 1fr"],
  .modal [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .page-body { padding: 8px; padding-bottom: 80px; }
  .topbar-title { font-size: 15px; }
}

/* ── LOGIN PAGE ──────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 20px; padding: 40px;
  box-shadow: 0 10px 40px var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo img { width: 80px; height: 80px; object-fit: contain; margin: 0 auto 15px; }
.login-logo h1 { font-size: 24px; font-weight: 800; margin-bottom: 5px; }
.login-logo p { font-size: 14px; color: var(--text-muted); }

/* ── UTILITY ─────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-full { width: 100%; }
.mt-3 { margin-top: 12px; }
.mb-4 { margin-bottom: 16px; }

/* Mobil Kartlar */
.order-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  display: block;
  color: var(--text);
}
.order-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.order-card-plate { display: flex; align-items: center; gap: 8px; }
.plate { font-family: 'Courier New', monospace; font-weight: 800; font-size: 13px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; letter-spacing: 1px; color: var(--text); }
.order-card-body { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.order-card-row { display: flex; flex-direction: column; gap: 3px; }
.order-card-label { font-size: 10px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.order-card-val { font-size: 13px; font-weight: 600; }
.order-card-full { grid-column: 1 / -1; }

/* Mobil Alt Navigasyon — Modern App Style */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; width: 100%;
  height: 64px;
  background: rgba(26, 28, 30, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: none; /* Desktopta kapalı */
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  z-index: 2100;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  gap: 4px;
  transition: all 0.2s;
}

.mobile-bottom-nav a svg {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.mobile-bottom-nav a.active {
  color: var(--primary);
}

.mobile-bottom-nav a.active svg {
  opacity: 1;
  color: var(--primary);
}

@media (max-width: 768px) {
  .mobile-bottom-nav { display: grid; }
  .page-body { padding-bottom: 80px !important; } /* Alttaki barın üstüne binmemesi için */
}

/* ── MODAL SİSTEMİ ────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  display: none; /* Varsayılan kapalı */
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  display: flex !important;
  opacity: 1;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 50px var(--shadow);
  position: relative;
  overflow: hidden;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 20px; padding: 5px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 768px) {
  .modal-overlay { padding: 12px; align-items: center; }
  .modal { border-radius: 16px; max-width: 100% !important; max-height: 88vh; overflow-y: auto; }
}

.order-card-full { grid-column: 1 / -1; }
