/* ==========================================================================
   THEME.CSS - DRAGTIMER 87 (FINAL VERSION)
   ========================================================================== */

/* 1. IMPORT FONTS */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;400;500;600;700&family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&family=Saira+Semi+Condensed:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* 2. VARIABLES */
:root {
  /* Color Palette */
  --bg-dark: #0f1115;
  --bg-card: #1b1e26;
  --bg-card-hover: #252a35;
  
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  
  --accent-green: #00e676;       /* Warna Utama (Hijau Racing) */
  --accent-red: #ff3344;         /* Untuk Foul/DNF */
  --accent-yellow: #ffc107;      /* Untuk Peringatan/Update */
  
  --border-color: #2d3748;
  
  /* Fonts */
  --font-ui: "Roboto Condensed", "Saira Semi Condensed", sans-serif;
  --font-race: "Rajdhani", "Saira Semi Condensed", sans-serif; /* Angka & Judul */

  /* Spacing & Effects */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  
  --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.4);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 3. RESET & BASE STYLES */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 50px; /* Space footer */
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 10px;
  width: 100%;
}

/* 4. TYPOGRAPHY */
h1, h2, h3, h4 {
  font-family: var(--font-race);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
}
h1 { font-weight: 800; line-height: 1.2; }
p { margin-bottom: 10px; }
a { text-decoration: none; transition: 0.2s; }

/* 5. BUTTONS */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

button:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(37, 99, 235, 0.4);
  filter: brightness(1.1);
}

button:active, .btn:active { transform: translateY(0); }

/* Varian Tombol */
.btn.secondary { background: #334155; color: #fff; }
.btn.secondary:hover { background: #475569; box-shadow: none; }

.btn-monitor-gradient {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--accent-green) !important;
  color: var(--accent-green) !important;
}
.btn-monitor-gradient:hover {
  background: var(--accent-green) !important;
  color: #000 !important;
  box-shadow: 0 0 20px rgba(0, 230, 118, 0.4);
}

/* 6. CARDS & GRID SYSTEM */
/* Grid Pintar: Otomatis mengecil di HP, tapi tidak kurang dari 300px */
.event-grid, .class-grid, .schedule-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr));
  gap: 20px;
  margin-top: 20px;
}

.card, .event-card, .class-card, .schedule-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 10px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
}

/* Efek Hover Kartu */
.event-card:hover, .class-card:hover, .schedule-item:hover {
  transform: translateY(-5px);
  border-color: var(--accent-green);
  box-shadow: var(--shadow-float);
  background: var(--bg-card-hover);
}

/* Garis Indikator Kiri pada Kartu Event */
.event-card::before, .class-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--border-color); transition: 0.3s;
}
.event-card:hover::before, .class-card:hover::before { background: var(--accent-green); }

/* Detail Teks dalam Kartu */
.event-date { font-family: var(--font-race); font-weight: 700; color: var(--accent-green); font-size: 1.1rem; margin-bottom: 5px; }
.event-title { font-size: 1.5rem; margin-bottom: 10px; color: #fff; }
.event-venue { color: var(--text-secondary); font-size: 0.9rem; display: flex; align-items: center; gap: 5px; }

/* 7. LIVE TIMING CONTROLS (hasil.php) */
.live-controls {
  display: flex; gap: 15px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-color);
}

.view-switcher {
  display: flex; background: #000; border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 4px; gap: 4px;
}

.view-btn {
  background: transparent; border: none; color: var(--text-secondary);
  padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-ui); font-weight: 600; font-size: 0.85rem;
  display: flex; align-items: center; gap: 6px; transition: 0.2s;
  text-transform: none; /* Reset uppercase dari button global */
}

.view-btn:hover { background: rgba(255,255,255,0.05); color: #fff; transform: none; box-shadow: none; }
.view-btn.active { background: var(--bg-card-hover); color: var(--accent-green); box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

.session-select {
  background: var(--bg-dark); color: white; border: 1px solid var(--border-color);
  padding: 10px 15px; border-radius: var(--radius-sm); font-family: var(--font-ui);
  min-width: 180px; cursor: pointer; font-size: 0.95rem;
}

/* Logic Tampilan (Grid/Table/Monitor) */
.view-container { display: none; width: 100%; }
.view-container.active { display: block !important; animation: fadeIn 0.4s ease-out; }

/* 8. RACER CARDS (Grid View) */
.race-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }

.racer-card {
  background: var(--bg-card); border-left: 5px solid var(--border-color);
  border-radius: var(--radius-md); overflow: hidden; position: relative;
  transition: transform 0.2s;
}

/* Status Colors */
.status-win { border-left-color: var(--accent-green); background: linear-gradient(to right, rgba(0, 230, 118, 0.05), var(--bg-card)); }
.status-dns { border-left-color: var(--accent-red); border-right: 5px solid var(--accent-red); opacity: 0.8; }
.status-jmp-dnf { border-left-color: var(--accent-red); border-right: 5px solid var(--accent-red); opacity: 0.8; }
.status-jmp-bro { border-left-color: var(--accent-red); border-right: 5px solid var(--accent-red); }
.status-dnf { border-left-color: var(--accent-red); opacity: 0.8; }
.status-jmp { border-left-color: var(--accent-red); }
.status-bro { border-right: 5px solid var(--accent-red); }

.rc-header { padding: 15px; display: flex; justify-content: space-between; align-items: flex-start; }
.rc-info h4 { font-size: 1.1rem; margin-bottom: 2px; }
.rc-number { font-family: var(--font-race); font-size: 2rem; font-weight: 800; color: rgba(255,255,255,0.5); line-height: 1; }
.status-win .rc-number { color: var(--accent-green); }

.rc-stats { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0,0,0,0.2); gap: 1px; border-top: 1px solid var(--border-color); }
.stat-box { background: var(--bg-card); padding: 10px 15px; display: flex; flex-direction: column; }
.lbl { font-size: 0.65rem; color: var(--text-secondary); text-transform: uppercase; font-weight: 700; margin-bottom: 2px; }
.val { font-family: var(--font-race); font-size: 1.3rem; font-weight: 700; color: #fff; line-height: 1.1; }
.val.ot { color: var(--accent-green); font-size: 1.5rem; }
.val.foul { color: var(--accent-red); }

.rc-extra { display: flex; justify-content: space-between; padding: 10px 15px; background: rgba(0,0,0,0.3); font-size: 1.3rem; }
.val-sm { font-family: var(--font-race); font-weight: 700; color: #fff; margin-left: 10px; }

/* 9. TABLE VIEW */
.table-responsive { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.race-table { width: 100%; border-collapse: collapse; background: var(--bg-card); min-width: 800px; }
.race-table th { background: rgba(255,255,255,0.05); padding: 15px; font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; text-align: center; }
.race-table th.t-left { text-align: left; }
.race-table td { padding: 12px 15px; border-bottom: 1px solid rgba(255,255,255,0.03); text-align: center; color: #fff; }
.race-table td.t-left { text-align: left; }
.race-table .mono { font-family: var(--font-race); font-size: 1.2rem; font-weight: 600; letter-spacing: 0.5px; }
.row-win { background: rgba(0, 230, 118, 0.05); }

/* 10. BIG MONITOR MODE */
.big-monitor { display: flex; flex-wrap: wrap; gap: 20px; width: 100%; }
.big-card {
  background: var(--bg-card); border: 2px solid var(--border-color);
  border-radius: 20px; flex: 1; min-width: 45%; padding: 2.5vw;
  position: relative; display: flex; flex-direction: column; justify-content: center;
}
.big-card.foul { border-color: var(--accent-red); }
.bc-number { font-family: var(--font-race); font-size: 6vw; font-weight: 800; color: rgba(255,255,255,0.5); position: absolute; right: 20px; top: 0; line-height: 1; }
.bc-header { position: relative; z-index: 2; margin-bottom: 1vw; }
.bc-rider { font-size: 3.5vw; font-weight: 700; line-height: 1.1; margin-bottom: 0.3vw; font-family: var(--font-race); color: #fff; }
.bc-team { font-size: 1.2vw; color: var(--accent-yellow); font-weight: 600; text-transform: uppercase; }

.bc-main-stats { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1vw; padding-bottom: 0vw; border-bottom: 2px solid rgba(255,255,255,0.1); }
.bc-lbl { font-size: 1vw; color: var(--accent-yellow); display: block; margin-bottom: 5px; font-weight: 600; }
.bc-val { font-family: var(--font-race); font-size: 7vw; font-weight: 800; line-height: 0.9; color: var(--accent-green); }
.bc-val.red { color: var(--accent-red); }

.bc-details { display: flex; justify-content: space-between; gap: 10px; }
.bc-d-item { background: rgba(0,0,0,0.3); padding: 1vw; border-radius: 10px; flex: 1; text-align: center; }
.bc-d-lbl { display: block; font-size: 0.9vw; color: var(--accent-yellow); margin-bottom: 5px; font-weight: 500; }
.bc-d-val { display: block; font-family: var(--font-race); font-size: 2vw; font-weight: 700; color: #fff; }
.bc-d-val.red { color: var(--accent-red) !important; }

/* 11. JADWAL (Schedule) */
.timeline-date-header { display: flex; align-items: center; gap: 12px; margin: 10px 0 10px 0; padding-bottom: 10px; border-bottom: 2px solid var(--accent-green); }
.time-badge { background: rgba(0, 230, 118, 0.08); color: var(--accent-green); border: 1px solid rgba(0, 230, 118, 0.3); padding: 8px 12px; border-radius: var(--radius-sm); font-family: var(--font-race); font-weight: 700; font-size: 1.3rem; min-width: 90px; text-align: center; }
.sc-stage { font-size: 0.75rem; font-weight: 700; color: var(--accent-yellow); text-transform: uppercase; margin-left: 20px; letter-spacing: 1px; background: rgba(255, 193, 7, 0.1); padding: 4px 8px; border-radius: 4px; border: 1px solid rgba(255, 193, 7, 0.2); }

/* 12. ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@keyframes flash-update {
  0% { border-color: var(--accent-yellow); filter: brightness(1.3); box-shadow: 0 0 20px rgba(255, 193, 7, 0.4); }
  100% { border-color: var(--border-color); filter: brightness(1); box-shadow: none; }
}
.updated { animation: flash-update 0.8s cubic-bezier(0.4, 0, 0.2, 1); }

/* 13. RESPONSIVE FIXES (Mobile) */
@media (max-width: 768px) {
  .container { padding: 15px; }
  h1 { font-size: 1.8rem; }
  
  /* Monitor Font Resizing for Mobile */
  .bc-rider { font-size: 6vw; }
  .bc-team { font-size: 3vw; }
  .bc-val { font-size: 14vw; }
  .bc-lbl { font-size: 3vw; }
  .bc-d-lbl { font-size: 2.5vw; }
  .bc-d-val { font-size: 5vw; }
  .big-card { min-width: 100%; padding: 20px; }
  
  /* Schedule Mobile */
  .schedule-item { flex-direction: column; align-items: flex-start; }
  .time-badge { margin-right: 0; margin-bottom: 10px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
  
  /* Hide Table Columns on Mobile */
  .hide-mobile { display: none; }
}

#results-container {
  padding-top: 20px;
}

/* --- RUN NAVIGATION BAR --- */
.run-nav-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    padding: 10px;
    display: flex;
    gap: 10px;
    overflow-x: auto; /* Scroll samping jika run banyak */
    z-index: 9999;
    border-top: 1px solid #333;
    white-space: nowrap;
}

/* Sembunyikan Scrollbar tapi tetap bisa discroll */
.run-nav-container::-webkit-scrollbar { height: 0px; background: transparent; }

.btn-run {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #222;
    color: #888;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-race); /* Pastikan font ini ada, atau ganti Arial */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    text-decoration: none;
    font-size: 1rem;
}

.btn-run:hover {
    background: #444;
    color: white;
    transform: scale(1.1);
}

.btn-run.active {
    background: var(--accent-yellow, #ffd700);
    color: black;
    border-color: var(--accent-yellow, #ffd700);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.btn-live {
    width: auto;
    padding: 0 20px;
    border-radius: 25px;
    background: #ff1744;
    color: white;
    border: none;
    font-weight: bold;
    margin-right: 15px;
}

.btn-live.active {
    background: #00e676; /* Hijau saat mode Live */
    box-shadow: 0 0 15px #00e676;
}

.loading-text {
	font-family: var(--font-race);
	width: 100%;
	height: 50vh;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	font-size: 5vw;
	color: #333;
	font-weight:800;
}

/* Update Posisi Dial - Center Bottom */
.bc-dial {
    position: relative; /* Ubah dari absolute ke relative/static */
    display: block;     /* Pastikan blok agar bisa dicenter */
    margin-top: 15px;   /* Jarak dari bc-details di atasnya */
    
    font-family: var(--font-race);
    font-size: 1.8vw;     /* Sedikit diperbesar agar jelas */
    font-weight: 600;
    color: #fff;
    
    text-align: center; /* Kunci untuk posisi Center */
    width: 100%;
    
    letter-spacing: 2px;
    line-height: 1;
    z-index: 5;
    
    /* Opsional: Memberi background full width atau pill shape */
    background: rgba(0,0,0,0.2); 
    padding: 5px 0;
    border-radius: 4px;
}

/* Update Responsif HP */
@media (max-width: 768px) {
    .bc-dial {
        font-size: 5vw; /* Ukuran font lebih besar di HP */
        margin-top: 10px;
        /* Reset properti lama (top/right) tidak perlu karena sudah tidak absolute */
    }
}