:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --secondary: #764ba2;
  --success: #4CAF50;
  --danger: #f44336;
  --warning: #ff9800;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --text: #e4e4e4;
  --text-muted: #999;
  --border: #2d3748;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--primary);
  padding: 15px 0;
  margin-bottom: 20px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  font-size: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Navigation */
.nav {
  background: var(--bg-card);
  margin-bottom: 30px;
  border-radius: 8px;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 5px;
  padding: 10px;
}

.nav-list a {
  color: var(--text);
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 6px;
  transition: all 0.3s;
}

.nav-list a:hover {
  background: var(--primary);
  color: white;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  text-decoration: none;
  background: var(--border);
  color: var(--text);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 5px;
}

/* Forms */
.form-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text);
  font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.input-group {
  display: flex;
  gap: 5px;
}

.input-group input {
  flex: 1;
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0f3460 100%);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-box {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border: 1px solid var(--border);
}

.login-box h1 {
  text-align: center;
  font-size: 48px;
  margin-bottom: 10px;
}

.login-box h2 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--text-muted);
  font-size: 18px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 25px;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-number {
  font-size: 48px;
  font-weight: bold;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  color: var(--text-muted);
  margin-top: 10px;
  font-size: 14px;
}

/* Section */
.section {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.section h3 {
  margin-bottom: 20px;
  color: var(--primary);
}

/* Events List */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-item {
  padding: 12px;
  background: var(--bg-dark);
  border-radius: 6px;
  display: flex;
  gap: 15px;
  align-items: center;
  font-size: 14px;
}

.event-time {
  color: var(--text-muted);
  min-width: 150px;
}

.event-action {
  color: var(--primary);
  font-weight: 500;
  min-width: 100px;
}

.event-goal {
  color: var(--text);
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.page-header h2 {
  color: var(--primary);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 12px 24px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
}

.tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Goals Table */
.goals-table {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.goal-row {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  transition: all 0.3s;
}

.goal-row:hover {
  border-color: var(--primary);
  transform: translateX(5px);
}

.goal-info {
  flex: 1;
}

.goal-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 5px;
}

.goal-description {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.goal-progress {
  color: var(--text-muted);
  font-size: 14px;
}

.goal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Grid Layouts */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Quick Controls */
.quick-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label {
  font-weight: 500;
  color: var(--text);
}

/* Info Card */
.info-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.info-card h3 {
  margin-bottom: 15px;
  color: var(--primary);
}

.url-display {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}

.url-display input {
  flex: 1;
  padding: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

/* Preview Card */
.preview-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 25px;
  border: 1px solid var(--border);
}

.preview-card h3 {
  margin-bottom: 15px;
  color: var(--primary);
}

.overlay-preview {
  background: var(--bg-dark);
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 15px 0;
}

.overlay-preview iframe {
  width: 100%;
  height: 500px;
  display: block;
}

/* Alerts */
.alert {
  padding: 12px 20px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.alert-error {
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid var(--danger);
  color: #ff6b6b;
}

/* Error Page */
.error-page {
  text-align: center;
  padding: 60px 20px;
}

.error-page h1 {
  font-size: 72px;
  margin-bottom: 20px;
}

.error-message {
  font-size: 24px;
  margin-bottom: 30px;
  color: var(--text-muted);
}

.error-page details {
  margin-top: 40px;
  text-align: left;
  background: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
}

.error-page pre {
  overflow-x: auto;
  font-size: 12px;
  color: var(--danger);
}

/* Utilities */
.text-muted {
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .goal-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .goal-actions {
    width: 100%;
  }
}
