/* CSS Custom Properties for Theming */
:root {
  /* Light theme colors */
  --bg-primary: #000000;
  --bg-secondary: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --accent-primary: #f97316;
  --accent-hover: #ea580c;
  --border-color: #333333;
  --logo-bg: linear-gradient(135deg, #f97316, #ea580c);
}

.dark-theme {
  /* Dark theme colors */
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --text-primary: #000000;
  --text-secondary: #666666;
  --accent-primary: #22c55e;
  --accent-hover: #16a34a;
  --border-color: #e5e5e5;
  --logo-bg: #000000;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: all 0.3s ease;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.install-btn {
  padding: 0.5rem 1rem;
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.install-btn:hover {
  background-color: var(--accent-hover);
}

.theme-toggle {
  background: var(--accent-primary);
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background-color: var(--accent-hover);
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: -16rem;
  top: 0;
  width: 16rem;
  height: 100vh;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  transition: left 0.3s ease;
  z-index: 200;
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
}

.sidebar-menu {
  list-style: none;
  padding: 1rem 0;
}

.sidebar-menu li {
  margin-bottom: 0.5rem;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 6px;
  margin: 0 0.5rem;
}

.sidebar-menu a:hover {
  background-color: var(--accent-primary);
  color: white;
}

.dark-theme .sidebar-menu a:hover {
  color: white;
}

.sidebar-menu a.active {
  background-color: var(--accent-primary);
  color: white;
}

.server-working::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  background-color: var(--accent-primary);
  border-radius: 50%;
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 150;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Main Content */
.main-content {
  padding: 2rem 1rem;
  max-width: 28rem;
  margin: 0 auto;
}

/* Pages */
.page {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.page.active {
  display: block;
}

/* Page Header */
.page-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-circle {
  width: 8rem;
  height: 8rem;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--logo-bg);
  color: white;
}

.dark-theme .logo-circle {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
}

.logo-text {
  text-align: center;
}

.logo-main {
  font-size: 1.5rem;
  font-weight: bold;
}

.logo-sub {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.page-subtitle {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--accent-primary);
}

/* Form Section */
.form-section {
  margin-bottom: 2rem;
}

.token-input {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 1.125rem;
  font-family: 'Monaco', 'Menlo', monospace;
  text-align: center;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.token-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.btn-primary {
  width: 100%;
  padding: 1rem;
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-bottom: 1rem;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.offline-text {
  text-align: center;
  color: var(--text-secondary);
}

.activate-link {
  color: var(--accent-primary);
  cursor: pointer;
}

/* Cards */
.user-card, .algorithm-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.user-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.user-avatar {
  width: 2rem;
  height: 2rem;
  background-color: var(--accent-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.version-badge {
  background-color: var(--accent-primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  text-align: center;
  margin-bottom: 1rem;
}

.stat-main {
  font-size: 2.5rem;
  font-weight: bold;
}

.stat-positive {
  color: var(--accent-primary);
  font-weight: 600;
}

.premium-status {
  text-align: center;
  margin-top: 1rem;
}

.spinner {
  width: 4rem;
  height: 4rem;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 0.5rem;
}

/* Action Buttons */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn-secondary {
  padding: 1rem;
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.btn-danger {
  padding: 1rem;
  background-color: #dc2626;
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.footer-text {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 2rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }
  
  .logo-circle {
    width: 6rem;
    height: 6rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: var(--accent-primary);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateX(0);
}

.toast.error {
  background-color: #dc2626;
}

.toast.success {
  background-color: #22c55e;
}