* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #333;
  height: 100vh;
  overflow: hidden;
}

.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  font-size: 64px;
  margin-bottom: 16px;
}

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 8px;
}

.login-subtitle {
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 32px;
}

.form-group {
  text-align: left;
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-outline {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #374151;
}

.btn-outline:hover {
  border-color: #667eea;
  color: #667eea;
}

.btn-block {
  width: 100%;
}

.login-error {
  color: #ef4444;
  font-size: 13px;
  margin-top: 16px;
  min-height: 20px;
}

.login-author {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
}

.login-author .author-label {
  color: #6b7280;
}

.login-author .author-name {
  color: #667eea;
  font-weight: 600;
  letter-spacing: 1px;
  font-family: 'Courier New', monospace;
}

.admin-page {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 240px;
  background: #1f2937;
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #374151;
}

.sidebar-logo {
  font-size: 28px;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  color: #9ca3af;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.nav-item:hover {
  background: #374151;
  color: white;
}

.nav-item.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.nav-icon {
  font-size: 18px;
}

.nav-text {
  font-size: 14px;
  font-weight: 500;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #374151;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  font-size: 24px;
}

.username {
  font-size: 14px;
  color: #d1d5db;
}

.author-info {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #374151;
  border-radius: 8px;
  text-align: center;
  font-size: 12px;
}

.author-text {
  color: #9ca3af;
}

.author-code {
  color: #a78bfa;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: #374151;
  border: none;
  color: #9ca3af;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: #4b5563;
  color: white;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-header {
  background: white;
  padding: 20px 32px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: #1f2937;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #10b981;
}

.connection-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse 2s infinite;
}

.connection-status.disconnected {
  color: #ef4444;
}

.connection-status.disconnected .status-dot {
  background: #ef4444;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

.page-content {
  display: none;
}

.page-content.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 14px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.stat-icon.goal {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.corner {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-icon.handicap {
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}

.stat-icon.today {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon.live {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-icon.total {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.stat-icon.online {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

.chart-section, .recent-events {
  background: white;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chart-section h3, .recent-events h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 20px;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-bar-label {
  width: 100px;
  font-size: 13px;
  color: #6b7280;
  text-align: right;
  flex-shrink: 0;
}

.chart-bar-wrapper {
  flex: 1;
  height: 28px;
  background: #f3f4f6;
  border-radius: 6px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
}

.chart-bar-value {
  width: 50px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  flex-shrink: 0;
}

.events-table {
  overflow-x: auto;
}

.events-table.full table {
  width: 100%;
}

.events-table table {
  width: 100%;
  border-collapse: collapse;
}

.events-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.events-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
}

.events-table tr:hover td {
  background: #f9fafb;
}

.empty-cell {
  text-align: center;
  color: #9ca3af;
  padding: 40px !important;
}

.event-type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.event-type-goal {
  background: #fee2e2;
  color: #dc2626;
}

.event-type-corner {
  background: #dbeafe;
  color: #2563eb;
}

.event-type-dangerous {
  background: #fef3c7;
  color: #d97706;
}

.event-type-penalty {
  background: #fce7f3;
  color: #db2777;
}

.event-type-yellow {
  background: #fef9c3;
  color: #a16207;
}

.event-type-red {
  background: #fee2e2;
  color: #dc2626;
}

.event-type-time {
  background: #e0e7ff;
  color: #4f46e5;
}

.event-type-handicap {
  background: #f0fdf4;
  color: #16a34a;
}

.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.filter-group select {
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: white;
  cursor: pointer;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.page-btn {
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.page-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

.page-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.match-card {
  background: white;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.live-badge {
  background: #ef4444;
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.match-time {
  font-size: 12px;
  color: #6b7280;
}

.match-teams {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.team {
  flex: 1;
  text-align: center;
}

.team-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}

.match-score {
  font-size: 24px;
  font-weight: 700;
  color: #667eea;
  padding: 0 20px;
}

.match-corners {
  display: flex;
  justify-content: space-around;
  font-size: 12px;
  color: #6b7280;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.match-handicap {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #f59e0b;
  padding: 8px 0;
  background: #fffbeb;
  border-radius: 8px;
  margin: 10px 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
  grid-column: 1 / -1;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-text {
  font-size: 14px;
}

.form-input {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: #667eea;
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card.mini {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.stat-card.mini .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card.mini .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 2px;
}

.stat-card.mini .stat-label {
  font-size: 12px;
  color: #6b7280;
}

.card-list {
  background: white;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
  gap: 16px;
}

.card-item:last-child {
  border-bottom: none;
}

.card-item-key {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: #1f2937;
  font-size: 14px;
  letter-spacing: 1px;
}

.card-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.card-type-badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #eef2ff;
  color: #6366f1;
}

.card-type-badge.day { background: #fef3c7; color: #d97706; }
.card-type-badge.week { background: #d1fae5; color: #059669; }
.card-type-badge.month { background: #e0e7ff; color: #4f46e5; }
.card-type-badge.year { background: #fce7f3; color: #db2777; }
.card-type-badge.admin { background: #dbeafe; color: #2563eb; }
.card-type-badge.user { background: #d1fae5; color: #059669; }

.card-status {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.card-status.unused {
  background: #d1fae5;
  color: #059669;
}

.card-status.used {
  background: #e5e7eb;
  color: #6b7280;
}

.card-item-date {
  font-size: 12px;
  color: #9ca3af;
}

.card-item-actions {
  display: flex;
  gap: 8px;
}

.btn-copy {
  padding: 5px 12px;
  background: #f3f4f6;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #4b5563;
  transition: all 0.2s;
}

.btn-copy:hover {
  background: #e5e7eb;
}

.btn-delete-card {
  padding: 5px 12px;
  background: #fef2f2;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #dc2626;
  transition: all 0.2s;
}

.btn-delete-card:hover {
  background: #fee2e2;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fef3c7;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: #d97706;
}

.connection-status.connected {
  background: #d1fae5;
  color: #059669;
}

.connection-status.disconnected {
  background: #fee2e2;
  color: #dc2626;
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  animation: pulse 2s infinite;
}

.connection-status.connected .conn-dot {
  background: #10b981;
}

.connection-status.disconnected .conn-dot {
  background: #ef4444;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.match-tips {
  margin-bottom: 16px;
}

.tip-card {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: #eff6ff;
  border-radius: 12px;
  border-left: 4px solid #3b82f6;
}

.tip-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.tip-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 4px;
}

.tip-text {
  font-size: 13px;
  color: #3b82f6;
  line-height: 1.6;
}

.settings-card {
  background: white;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.settings-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.settings-desc {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 20px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

.form-row label {
  font-size: 14px;
  color: #374151;
}

.switch {
  position: relative;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d1d5db;
  transition: 0.3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background-color: #667eea;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.api-key-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 10px;
}

.api-key-display code {
  flex: 1;
  font-size: 14px;
  color: #374151;
  font-family: 'Consolas', monospace;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-title, .nav-text, .username, .btn-logout {
    display: none;
  }
  .sidebar-header {
    justify-content: center;
  }
  .nav-item {
    justify-content: center;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
