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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border-color: #475569;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
}

body {
  overflow-x: hidden;
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.page {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Navigation */
.navbar {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-light) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-radius: 12px;
}

.navbar-brand {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-info {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: var(--surface-light);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.8);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

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

/* Forms */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Cards */
.card {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(51, 65, 85, 0.5) 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Auth Page */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--background) 0%, #1a1f35 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card .card {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.auth-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 0 16px;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  margin: 0 -16px;
  padding: 8px 16px;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-form-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-header h1 {
  font-size: 32px;
  font-weight: 700;
}

.dashboard-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(51, 65, 85, 0.5) 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-light);
}

.stat-subtext {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Activities */
.activities-container {
  display: grid;
  gap: 12px;
}

.activity-item {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.activity-item:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.activity-info {
  flex: 1;
}

.activity-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.activity-details {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.activity-duration {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-light);
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

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

.activity-actions button {
  padding: 6px 12px;
  font-size: 12px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-in;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 32px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 24px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.chart-container {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(51, 65, 85, 0.5) 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  min-height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 350px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
}

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

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar {
    flex-direction: column;
    gap: 16px;
  }

  .navbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .activity-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .activity-actions {
    width: 100%;
    flex-direction: row;
  }

  .modal-content {
    width: 95%;
    padding: 24px;
  }

  .auth-header h1 {
    font-size: 24px;
  }
}

/* Utilities */
.text-center {
  text-align: center;
}

.mt-24 {
  margin-top: 24px;
}

.mb-16 {
  margin-bottom: 16px;
}

.gap-12 {
  gap: 12px;
}

.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.success-message {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* Buttons */
button, .btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover, .btn:hover {
  transform: translateY(-1px);
}

/* Input fields */
input, select, textarea {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Analytics Chart Container */
.chart-container {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(51, 65, 85, 0.4) 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* Analytics Date Picker */
#analytics-date {
  max-width: 200px;
  margin-bottom: 20px;
}

/* Chart wrapper */
.chart-wrapper {
  position: relative;
  width: 300px;  /* fixed width for small chart */
  height: 300px; /* fixed height */
}

/* Analytics Table (if needed later) */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.analytics-table th,
.analytics-table td {
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  color: var(--text-primary);
}

.analytics-table th {
  background: var(--surface-light);
  font-weight: 600;
}

.analytics-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.05);
}

.analytics-table tr:hover {
  background: rgba(99, 102, 241, 0.1);
}
