/* OKYS — Olay Komuta Yönetim Sistemi
   Kurumsal tasarım sistemi */

:root {
  /* Kurumsal renk paleti — resmi, güven veren */
  --color-navy-950: #0a1628;
  --color-navy-900: #0f2744;
  --color-navy-800: #1a365d;
  --color-navy-700: #234876;
  --color-navy-600: #2d5a8a;
  --color-navy-500: #3d6fa3;

  --color-red-600: #c41e3a;
  --color-red-500: #dc2626;
  --color-red-100: #fee2e2;

  --color-amber-500: #f59e0b;
  --color-amber-100: #fef3c7;

  --color-green-600: #059669;
  --color-green-500: #10b981;
  --color-green-100: #d1fae5;

  --color-blue-500: #3b82f6;
  --color-blue-100: #dbeafe;

  --color-purple-500: #8b5cf6;
  --color-teal-500: #14b8a6;

  /* Nötr tonlar */
  --color-gray-50: #f8fafc;
  --color-gray-100: #f1f5f9;
  --color-gray-200: #e2e8f0;
  --color-gray-300: #cbd5e1;
  --color-gray-400: #94a3b8;
  --color-gray-500: #64748b;
  --color-gray-600: #475569;
  --color-gray-700: #334155;
  --color-gray-800: #1e293b;
  --color-gray-900: #0f172a;

  /* Semantik */
  --bg-app: var(--color-gray-100);
  --bg-sidebar: var(--color-navy-900);
  --bg-topbar: #ffffff;
  --bg-panel: #ffffff;
  --text-primary: var(--color-gray-900);
  --text-secondary: var(--color-gray-600);
  --text-muted: var(--color-gray-500);
  --border-color: var(--color-gray-200);
  --accent: var(--color-red-600);
  --accent-hover: #a01830;

  /* Boyutlar */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --transition: 150ms ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
}

/* Layout */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}

.sidebar-toggle:hover {
  background: var(--color-gray-100);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-emblem {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand-emblem img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-emblem svg {
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--color-navy-900);
  letter-spacing: 0.02em;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 480px;
}

.incident-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.incident-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-gray-400);
  flex-shrink: 0;
}

.incident-status-dot.active {
  background: var(--color-red-500);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.incident-select {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--color-gray-50);
  color: var(--text-primary);
  cursor: not-allowed;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.alert-indicator {
  position: relative;
  color: var(--text-secondary);
  cursor: default;
}

.alert-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--color-red-500);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.datetime {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.datetime-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.datetime-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-navy-800);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border-color);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-navy-700), var(--color-navy-900));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: transform var(--transition);
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
}

.nav-section {
  margin-bottom: 1.25rem;
}

.nav-section-title {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  padding: 0 0.75rem;
  margin-bottom: 0.375rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.nav-item.active {
  background: rgba(196, 30, 58, 0.2);
  color: white;
  border-left: 3px solid var(--color-red-500);
  padding-left: calc(0.75rem - 3px);
}

.nav-item.active svg {
  opacity: 1;
  color: var(--color-red-500);
}

.nav-badge {
  margin-left: auto;
  background: var(--color-red-500);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.org-badge {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.org-label {
  display: block;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.org-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  line-height: 1.3;
}

.org-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 0.15rem;
}

.org-unit {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  background: var(--bg-app);
}

.page {
  display: none;
  animation: fadeIn 0.2s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-navy-900);
  letter-spacing: -0.02em;
}

.page-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-primary {
  background: var(--color-navy-800);
  color: white;
}

.btn-danger {
  background: var(--color-red-600);
  color: white;
}

.btn-danger:hover {
  background: var(--color-red-500);
}

.btn-outline {
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

/* Status Strip */
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.status-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.status-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-red { background: var(--color-red-100); color: var(--color-red-600); }
.kpi-icon-blue { background: var(--color-blue-100); color: var(--color-blue-500); }
.kpi-icon-green { background: var(--color-green-100); color: var(--color-green-600); }
.kpi-icon-amber { background: var(--color-amber-100); color: var(--color-amber-500); }
.kpi-icon-purple { background: #ede9fe; color: var(--color-purple-500); }
.kpi-icon-teal { background: #ccfbf1; color: var(--color-teal-500); }

.kpi-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-navy-900);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.kpi-change {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.kpi-change.positive { color: var(--color-green-600); }
.kpi-change.warning { color: var(--color-amber-500); }

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: auto auto;
  gap: 1rem;
}

.dashboard-grid-extended {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1rem;
}

.dashboard-grid-extended .panel-half {
  grid-column: span 1;
}

.panel-half {
  min-height: auto;
}

.panel-wide {
  grid-column: 1;
  grid-row: 1 / 3;
}

.dashboard-grid-extended .panel-wide {
  grid-row: 1 / 4;
}

/* Büyük buton — afet anı / telsiz ekranı */
.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Responsive */
@media (max-width: 1200px) {
  .dashboard-grid,
  .dashboard-grid-extended {
    grid-template-columns: 1fr;
  }

  .panel-wide {
    grid-row: auto;
  }

  .panel-half {
    grid-column: auto;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .topbar-center {
    display: none;
  }

  .datetime {
    display: none;
  }

  .main-content {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
  }

  .status-strip {
    flex-direction: column;
    gap: 0.75rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .user-info {
    display: none;
  }
}
