/**
 * @file mibzer-design-system.css
 * @brief Mibzer Bulut Dashboard tasarim sistemi
 * @version 1.0.0
 * @date 2026-04-05
 *
 * Kullanim: <link rel="stylesheet" href="/css/mibzer-design-system.css">
 * Tum sayfalarda ortak kullanilan degiskenler, reset, tipografi ve komponentler.
 * Sayfa-ozel stiller ayri <style> blogunda tanimlanir.
 */

/* ========================================
   1. CSS CUSTOM PROPERTIES
   ======================================== */

:root {
  /* --- Yuzeyler --- */
  --bg-primary: #0a0c0f;
  --bg-secondary: #111318;
  --bg-tertiary: #181b22;
  --bg-elevated: #1e2129;
  --bg-input: #0d0f13;

  /* --- Kenarlar --- */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-accent: rgba(0, 229, 160, 0.3);

  /* --- Metin --- */
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a8;
  --text-muted: #6b727b;
  --text-inverse: #0a0c0f;

  /* --- Aksanlar --- */
  --accent-primary: #00e5a0;
  --accent-primary-hover: #00cc8e;
  --accent-primary-subtle: rgba(0, 229, 160, 0.12);
  --accent-secondary: #0077ff;
  --accent-secondary-hover: #0066dd;
  --accent-secondary-subtle: rgba(0, 119, 255, 0.12);

  /* --- Durum --- */
  --status-success: #00e5a0;
  --status-warning: #ffb800;
  --status-danger: #ff4757;
  --status-info: #0077ff;
  --status-neutral: #6b727b;

  --status-success-bg: rgba(0, 229, 160, 0.10);
  --status-warning-bg: rgba(255, 184, 0, 0.10);
  --status-danger-bg: rgba(255, 71, 87, 0.10);
  --status-info-bg: rgba(0, 119, 255, 0.10);

  /* --- Tarim Ozel --- */
  --soil-brown: #8B6914;
  --crop-green: #2ecc71;
  --wheat-gold: #f0c040;
  --water-blue: #3498db;

  /* --- Golge --- */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(0, 229, 160, 0.15);

  /* --- Boyut --- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* --- Gecis --- */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* --- Spacing --- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* --- Tipografi --- */
  --font-ui: 'Syne', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-data: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --text-xs: 0.7rem;
  --text-sm: 0.8rem;
  --text-base: 0.95rem;
  --text-lg: 1.1rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.7rem;
  --text-3xl: 2.2rem;
}

/* ========================================
   2. RESET & BASE
   ======================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Grid arka plan dekorasyonu */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    linear-gradient(rgba(0, 229, 160, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 160, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: -1;
}

a { color: var(--accent-primary); text-decoration: none; }
a:hover { color: var(--accent-primary-hover); }

img { max-width: 100%; height: auto; }

/* ========================================
   3. LAYOUT
   ======================================== */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
  padding: var(--space-lg);
}

.layout-sidebar {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}
@media (max-width: 768px) {
  .layout-sidebar { grid-template-columns: 1fr; }
}

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ========================================
   4. TOP BAR
   ======================================== */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar .logo {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: -0.02em;
}

.top-bar .nav-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.top-bar .nav-links a {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.top-bar .nav-links a:hover,
.top-bar .nav-links a.active {
  color: var(--accent-primary);
}

/* ========================================
   5. CARD
   ======================================== */

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ========================================
   6. METRIC CARD
   ======================================== */

.metric-card {
  text-align: center;
  padding: var(--space-lg);
}

.metric-value {
  font-family: var(--font-data);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--accent-primary);
  line-height: 1;
}

.metric-unit {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--space-xs);
}

.metric-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

/* Tehlike durumu — kirmizi metric */
.metric-card.danger .metric-value { color: var(--status-danger); }
.metric-card.warning .metric-value { color: var(--status-warning); }

/* ========================================
   7. BADGE
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-success { background: var(--status-success-bg); color: var(--status-success); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning); }
.badge-danger  { background: var(--status-danger-bg);  color: var(--status-danger);  }
.badge-info    { background: var(--status-info-bg);    color: var(--status-info);    }
.badge-neutral { background: rgba(107, 114, 123, 0.1); color: var(--status-neutral); }

.badge-live::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ========================================
   8. BUTTON
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-danger {
  background: var(--status-danger);
  color: white;
}
.btn-danger:hover {
  background: #e63e4f;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.btn-sm { padding: 8px 16px; min-height: 36px; font-size: var(--text-sm); }
.btn-lg { padding: 16px 32px; min-height: 52px; font-size: var(--text-lg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ========================================
   9. INPUT
   ======================================== */

.input {
  width: 100%;
  padding: 12px 16px;
  min-height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  transition: border-color var(--transition-fast);
}
.input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-subtle);
}
.input::placeholder { color: var(--text-muted); }

.input-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239aa0a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ========================================
   10. DATA TABLE
   ======================================== */

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-default);
}

.data-table td {
  padding: 12px 16px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table tr:hover td {
  background: var(--bg-tertiary);
}

.data-table td.num {
  font-family: var(--font-data);
  text-align: right;
}

/* ========================================
   11. ANIMATIONS
   ======================================== */

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

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

@keyframes dataFlash {
  0% { background: var(--accent-primary-subtle); }
  100% { background: transparent; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 229, 160, 0.2); }
  50%      { box-shadow: 0 0 20px rgba(0, 229, 160, 0.4); }
}

.animate-in { animation: fadeUp 0.4s ease-out forwards; }
.animate-down { animation: fadeDown 0.3s ease-out forwards; }
.data-updated { animation: dataFlash 0.6s ease-out; }
.glow { animation: glow 2s ease-in-out infinite; }

.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========================================
   12. UTILITY CLASSES
   ======================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--status-success); }
.text-warning { color: var(--status-warning); }
.text-danger { color: var(--status-danger); }
.text-data { font-family: var(--font-data); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); border: 0;
}

/* ========================================
   13. RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    padding: var(--space-md);
  }
  .top-bar {
    padding: var(--space-sm) var(--space-md);
  }
  .card {
    padding: var(--space-md);
  }
  .hide-mobile { display: none; }
}

@media (max-width: 480px) {
  :root {
    --text-3xl: 1.8rem;
    --text-2xl: 1.4rem;
  }
}
