<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Request Intelligence Dashboard</title>
<style>
  :root {
    --bg: #0a0c10;
    --bg2: #0f1218;
    --bg3: #161b24;
    --border: #1e2530;
    --accent: #00d4ff;
    --accent2: #7c3aed;
    --accent3: #f59e0b;
    --green: #10b981;
    --red: #ef4444;
    --text: #e2e8f0;
    --muted: #64748b;
    --card: #111620;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { background: var(--bg); color: var(--text); font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 13px; }
  
  a { color: var(--accent); text-decoration: none; }

  /* Header */
  .header {
    background: linear-gradient(135deg, #0f1218 0%, #111a2e 50%, #0f1218 100%);
    border-bottom: 1px solid var(--border);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
  }
  .header-title { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
  .header-title span { color: var(--accent); }
  .header-meta { color: var(--muted); font-size: 11px; }
  .live-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--green); margin-right:6px; animation: pulse 2s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

  /* Layout */
  .container { max-width: 1600px; margin: 0 auto; padding: 24px 32px; }
  
  /* KPI Row */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
  }
  .kpi {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    position: relative;
    overflow: hidden;
  }
  .kpi::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
  }
  .kpi-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
  .kpi-val { font-size: 28px; font-weight: 700; line-height: 1; }
  .kpi-sub { color: var(--muted); font-size: 10px; margin-top: 4px; }
  .kpi.green .kpi-val { color: var(--green); }
  .kpi.red .kpi-val { color: var(--red); }
  .kpi.blue .kpi-val { color: var(--accent); }
  .kpi.yellow .kpi-val { color: var(--accent3); }
  .kpi.purple .kpi-val { color: #a78bfa; }

  /* Sections */
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
  .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
  .grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 16px; }
  @media(max-width:1200px){ .grid-3{grid-template-columns:1fr 1fr;} .grid-4{grid-template-columns:1fr 1fr;} }
  @media(max-width:768px){ .grid-2,.grid-3,.grid-4{grid-template-columns:1fr;} }

  .card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
  }
  .card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg3);
  }
  .card-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
  .card-body { padding: 16px; }
  .card-badge { font-size: 10px; background: var(--border); border-radius: 4px; padding: 2px 8px; color: var(--muted); }

  /* Bar chart */
  .bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }
  .bar-label { width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; flex-shrink: 0; }
  .bar-track { flex: 1; background: var(--bg3); border-radius: 3px; height: 16px; overflow: hidden; }
  .bar-fill { height: 100%; border-radius: 3px; transition: width .3s; background: linear-gradient(90deg, var(--accent2), var(--accent)); min-width: 2px; }
  .bar-fill.green { background: linear-gradient(90deg, #059669, var(--green)); }
  .bar-fill.orange { background: linear-gradient(90deg, #d97706, var(--accent3)); }
  .bar-fill.red { background: linear-gradient(90deg, #b91c1c, var(--red)); }
  .bar-fill.purple { background: linear-gradient(90deg, #5b21b6, #a78bfa); }
  .bar-count { font-size: 11px; color: var(--muted); width: 60px; text-align: right; flex-shrink: 0; }

  /* Hourly chart */
  .hourly-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 80px;
    padding: 8px 0;
  }
  .hour-bar { flex: 1; background: var(--accent2); border-radius: 2px 2px 0 0; min-height: 2px; transition: opacity .2s; position: relative; }
  .hour-bar:hover { opacity: .7; cursor: default; }
  .hourly-labels { display: flex; gap: 3px; margin-top: 4px; }
  .hour-label { flex: 1; font-size: 9px; color: var(--muted); text-align: center; }

  /* Log table */
  .log-table { width: 100%; border-collapse: collapse; font-size: 11px; }
  .log-table th { 
    background: var(--bg3); 
    padding: 8px 10px; 
    text-align: left; 
    color: var(--muted); 
    font-size: 10px; 
    text-transform: uppercase; 
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }
  .log-table td { 
    padding: 7px 10px; 
    border-bottom: 1px solid var(--border); 
    vertical-align: middle;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .log-table tr:hover td { background: var(--bg3); }
  .log-table tr:last-child td { border-bottom: none; }

  /* Badges */
  .badge { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 10px; font-weight: 600; }
  .badge-blue   { background: rgba(0,212,255,.15); color: var(--accent); }
  .badge-green  { background: rgba(16,185,129,.15); color: var(--green); }
  .badge-red    { background: rgba(239,68,68,.15); color: var(--red); }
  .badge-yellow { background: rgba(245,158,11,.15); color: var(--accent3); }
  .badge-purple { background: rgba(124,58,237,.15); color: #a78bfa; }
  .badge-gray   { background: var(--border); color: var(--muted); }

  /* Flag emoji */
  .flag { font-size: 14px; }

  /* Scroll */
  .scroll-x { overflow-x: auto; }
  
  /* Section label */
  .section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    margin: 24px 0 12px;
    border-left: 3px solid var(--accent2);
    padding-left: 10px;
  }

  /* Donut-like device pie (CSS only) */
  .device-stats { display: flex; gap: 24px; align-items: center; }
  .device-item { text-align: center; }
  .device-icon { font-size: 28px; margin-bottom: 4px; }
  .device-num { font-size: 20px; font-weight: 700; }
  .device-lbl { font-size: 10px; color: var(--muted); }
  
  /* Toggle detail row */
  .detail-row { display: none; background: var(--bg2) !important; }
  .detail-row td { padding: 12px 16px !important; white-space: normal !important; max-width: none !important; }
  .detail-json { 
    background: var(--bg); 
    border-radius: 6px; 
    padding: 12px; 
    font-size: 11px; 
    overflow-x: auto; 
    border: 1px solid var(--border);
    max-height: 400px;
    overflow-y: auto;
    white-space: pre;
  }
  .clickable { cursor: pointer; user-select: none; }
  .clickable:hover td { background: #1a2035 !important; }

  /* Refresh btn */
  .btn { 
    background: var(--accent2); 
    color: #fff; 
    border: none; 
    border-radius: 5px; 
    padding: 6px 14px; 
    cursor: pointer; 
    font-size: 12px; 
    font-family: inherit;
  }
  .btn:hover { background: #6d28d9; }
  .btn-sm { padding: 3px 10px; font-size: 11px; }
  
  /* Empty state */
  .empty { text-align: center; padding: 60px; color: var(--muted); }
  .empty-icon { font-size: 48px; margin-bottom: 12px; }
  
  /* Highlight */
  .hl-bot { background: rgba(239,68,68,.08); }
  .hl-proxy { background: rgba(245,158,11,.08); }
</style>
</head>
<body>

<div class="header">
  <div>
    <div class="header-title">REQUEST <span>INTELLIGENCE</span> DASHBOARD</div>
    <div class="header-meta" style="margin-top:4px">
      <span class="live-dot"></span>
      Canlı Log Analizi — Son güncelleme: 23:00:32    </div>
  </div>
  <div style="display:flex;gap:10px;align-items:center">
    <span style="color:var(--muted);font-size:11px">/home/buyv/public_html/request_logs.json</span>
    <button class="btn" onclick="location.reload()">↻ Yenile</button>
    <a href="?clear=1" class="btn" style="background:var(--red);font-size:11px" onclick="return confirm('Logları sil?')">✕ Temizle</a>
    <a href="?export=json" class="btn" style="background:#1e2530;font-size:11px">⬇ JSON</a>
  </div>
</div>

[]