:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --center-cap: #ffffff;
}

/* Dark Mode Variables */
body.dark-mode {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --center-cap: #1e293b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 22px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* Toggle Switch Styles */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-sun { color: #f59e0b; font-size: 16px; }
.icon-moon { color: #94a3b8; font-size: 16px; }

.theme-switch {
  display: inline-block;
  height: 24px;
  position: relative;
  width: 48px;
}

.theme-switch input { display: none; }

.slider {
  background-color: #cbd5e1;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: .4s;
}

.slider:before {
  background-color: #ffffff;
  bottom: 3px;
  content: "";
  height: 18px;
  left: 3px;
  position: absolute;
  transition: .4s;
  width: 18px;
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(24px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* Main Layout */
.main-layout {
  display: flex;
  flex: 1;
  height: calc(100vh - 57px);
  overflow: hidden;
}

/* Sidebar Kiri */
.panel-section {
  width: 380px;
  background-color: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

/* Block Project Name di Sidebar */
.project-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.project-input {
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  color: var(--text);
  background: var(--bg);
  padding: 8px 12px;
  width: 100%;
}

.project-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Container pembagi Entries dan Results secara fleksibel 50-50 */
.split-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 16px;
  min-height: 0; /* Menstabilkan flex child di browser Firefox/Chrome */
}

.panel-block {
  display: flex;
  flex-direction: column;
  flex: 1; /* Ukuran persis sama 50:50 */
  min-height: 0;
}

.panel-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.entries-textarea {
  width: 100%;
  flex: 1;
  height: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: none;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  background-color: var(--bg);
  color: var(--text);
}

.entries-textarea:focus {
  border-color: var(--primary);
  background-color: var(--card-bg);
}

.results-list {
  flex: 1;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
  background-color: var(--bg);
  margin-bottom: 8px;
}

.results-list li {
  padding: 8px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.results-list li .badge {
  background-color: #dbeafe;
  color: #1e40af;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
}

body.dark-mode .results-list li .badge {
  background-color: #1e3a8a;
  color: #93c5fd;
}

.results-list li.winner-gold {
  background-color: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
  font-weight: 700;
}

body.dark-mode .results-list li.winner-gold {
  background-color: #78350f;
  border-color: #f59e0b;
  color: #fef3c7;
}

.results-list li.winner-silver {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
  font-weight: 600;
}

body.dark-mode .results-list li.winner-silver {
  background-color: #334155;
  border-color: #94a3b8;
  color: #f8fafc;
}

.results-list li.winner-bronze {
  background-color: #ffedd5;
  border-color: #f97316;
  color: #451a03;
  font-weight: 600;
}

body.dark-mode .results-list li.winner-bronze {
  background-color: #7c2d12;
  border-color: #f97316;
  color: #ffedd5;
}

@keyframes slideIn {
  0% { transform: translateX(-30px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

.action-group {
  display: flex;
  gap: 8px;
}

.btn-action {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  background-color: var(--card-bg);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-action:hover { background-color: var(--bg); }

.btn-action.btn-clear {
  background-color: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

body.dark-mode .btn-action.btn-clear {
  background-color: #450a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}

/* Spinner Section Kanan */
.wheel-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-y: auto;
}

.wheel-container {
  position: relative;
  width: 420px;
  height: 420px;
  max-width: 90vw;
  max-height: 90vw;
}

.pointer {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 16px solid transparent;
  border-bottom: 16px solid transparent;
  border-right: 32px solid #ef4444;
  z-index: 10;
  filter: drop-shadow(-2px 0 3px rgba(0,0,0,0.15));
}

canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.spin-btn {
  margin-top: 24px;
  padding: 14px 48px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background-color: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.spin-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.spin-btn:disabled {
  background-color: #94a3b8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@media (max-width: 900px) {
  .main-layout {
    flex-direction: column-reverse;
    height: auto;
    overflow: visible;
  }
  .panel-section {
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--border);
  }
  .split-container {
    height: 600px;
  }
}

@media (max-width: 600px) {
  header { padding: 12px 16px; }
  .brand-title { font-size: 15px; }
  .wheel-container { width: 300px; height: 300px; }
  .spin-btn { padding: 12px 32px; font-size: 16px; }
}


.btn-action.btn-refresh {
  background-color: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}

.btn-action.btn-refresh:hover {
  background-color: #dcfce7;
}

body.dark-mode .btn-action.btn-refresh {
  background-color: #052e16;
  color: #86efac;
  border-color: #14532d;
}

