/* ============================================================
   İNŞAAT ERP — MAIN CSS
   Anayasa V2.0 — Bölüm 6 / EK2 — Bölüm 5
   CSS Variables, reset, base styles, utilities
   ============================================================ */

/* ---------- 1. THEME VARIABLES ---------- */

:root {
  /* Gündüz (varsayılan) */
  --bg-primary: #f9fafb;
  --bg-card: #ffffff;
  --bg-input: #f3f4f6;
  --bg-hover: #f3f4f6;
  /* Takma adlar — bazı modüller bu adları kullanıyor (work-plan kartları, person-card vb.).
     Tema token'larına bağlı olduğundan koyu/açık modda otomatik doğru renge döner. */
  --bg-surface: var(--bg-card);
  --bg-muted: var(--bg-input);
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.10);

  /* Marka renkleri (modül renkleri — sabit) */
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --accent-cyan: #06b6d4;
  --accent-teal: #14b8a6;
  --accent-orange: #f97316;
  --accent-indigo: #6366f1;
  --accent-pink: #ec4899;
  --accent-sky: #6366f1;       /* indigo (eski sky #0ea5e9 — modern SaaS estetik) */
  --accent-primary: #6366f1;   /* takma ad — bazı modüller (teklif vb.) bu adı kullanıyor */
  --accent-violet: #a855f7;
  --accent-emerald: #22c55e;
  --accent-gold: #eab308;
  --accent-slate: #64748b;
  --accent-deepcyan: #0891b2;
  --accent-stone: #78716c;

  /* Durum renkleri */
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-error: #ef4444;
  --status-info: #0ea5e9;

  /* Boyut sabitleri */
  --header-height: 48px;
  --sidebar-width: 200px;
  --sidebar-collapsed-width: 52px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --touch-min: 44px;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.6);
  --bg-input: #334155;
  /* 🆕 Alias değişkenleri dark'ta yeniden bağla — yoksa :root'ta hesaplanan AÇIK değerde
     kalıyor → bunları kullanan (sonradan eklenen) modüller (İş Planı vb.) dark'ta beyaz çıkıyordu. */
  --bg-surface: var(--bg-card);
  --bg-muted: var(--bg-input);
  --bg-hover: rgba(51, 65, 85, 0.5);
  --border: rgba(51, 65, 85, 0.4);
  --border-strong: rgba(71, 85, 105, 0.6);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Koyu modda native <select> açılır listesi (option/optgroup) okunabilir olsun.
   Tarayıcı varsayılanı koyu zeminde koyu metin veriyor → solid koyu zemin + açık metin. */
[data-theme="dark"] select option,
[data-theme="dark"] select optgroup {
  background-color: #1e293b;
  color: #f1f5f9;
}

/* ---------- 2. RESET ---------- */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease, color 0.2s ease;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* ---------- 3. SCROLLBAR ---------- */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Yatay scroll için (sekmeler, KPI bar) */
.scroll-x {
  overflow-x: auto;
  scrollbar-width: none;
}

.scroll-x::-webkit-scrollbar {
  display: none;
}

/* ---------- 4. GEÇİŞ ANİMASYONLARI ---------- */

* {
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

/* ---------- 5. UTILITY: CARD ---------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .card {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---------- 6. UTILITY: BADGE ---------- */

/* Pill-style badges — Ödeme Planı estetik (pastel + uppercase + small) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.625rem;        /* 10px — referans */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border: 0;                   /* outlined kalkar — düz pastel pill */
  line-height: 1.4;
}

.badge-success {
  background: #dcfce7;          /* green-100 — referans */
  color: #166534;               /* green-800 */
}

.badge-warning {
  background: #fef3c7;          /* amber-100 */
  color: #92400e;               /* amber-800 */
}

.badge-danger {
  background: #fee2e2;          /* red-100 */
  color: #991b1b;               /* red-800 */
}

.badge-info {
  background: #e0e7ff;          /* indigo-100 */
  color: #3730a3;               /* indigo-800 */
}

.badge-neutral {
  background: #f1f5f9;          /* slate-100 */
  color: #475569;               /* slate-600 */
}

[data-theme="dark"] .badge-success { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
[data-theme="dark"] .badge-warning { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
[data-theme="dark"] .badge-danger  { background: rgba(239, 68, 68, 0.18);  color: #fca5a5; }
[data-theme="dark"] .badge-info    { background: rgba(99, 102, 241, 0.20); color: #a5b4fc; }
[data-theme="dark"] .badge-neutral { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

/* ---------- 7. UTILITY: KPI CARD ---------- */

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 140px;
  box-shadow: var(--shadow-sm);
}

.kpi-card-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.kpi-card-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.kpi-card-delta {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.kpi-card-delta.up {
  color: var(--status-success);
}

.kpi-card-delta.down {
  color: var(--status-error);
}

/* ---------- 8. UTILITY: SECTION ---------- */

.section-title {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.35rem 0.625rem 0.2rem;
}

.muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

/* ---------- 9. RESPONSIVE BREAKPOINTS ---------- */
/*
   Mobile  : <  768px (varsayılan, mobile-first)
   Tablet  : >= 768px
   Desktop : >= 1024px
*/

@media (min-width: 768px) {
  body {
    font-size: 14px;
  }
}

@media (min-width: 1024px) {
  body {
    font-size: 14px;
  }
}

/* ---------- 10. UTILITY HELPER CLASSES ---------- */

.hidden-mobile {
  display: none;
}

@media (min-width: 768px) {
  .hidden-mobile {
    display: initial;
  }

  .hidden-desktop {
    display: none;
  }
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.w-full {
  width: 100%;
}
