@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --accent: #06b6d4;
  --accent-dark: #0891b2;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --dark: #0f172a;
  --darker: #020617;
  --surface: #1e293b;
  --surface-light: #334155;
  --border: #475569;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --glow: rgba(99, 102, 241, 0.4);
  --glow-cyan: rgba(6, 182, 212, 0.4);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(ellipse at top, #1e293b 0%, #0f172a 50%, #020617 100%);
  min-height: 100vh;
  color: var(--text);
  line-height: 1.6;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  perspective: 1000px;
}

/* Animated 3D background */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 30% 40%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(6, 182, 212, 0.15) 0%, transparent 50%);
  animation: backgroundOrbit 25s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    repeating-linear-gradient(90deg, rgba(99, 102, 241, 0.03) 0px, transparent 1px, transparent 40px, rgba(99, 102, 241, 0.03) 41px),
    repeating-linear-gradient(0deg, rgba(99, 102, 241, 0.03) 0px, transparent 1px, transparent 40px, rgba(99, 102, 241, 0.03) 41px);
  animation: gridScroll 30s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes backgroundOrbit {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(50px, -50px) rotate(5deg); }
}

@keyframes gridScroll {
  0% { transform: translate(0, 0); }
  100% { transform: translate(40px, 40px); }
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Login & Admin with 3D effects */
.login-container, .admin-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 20px;
}

.login-box, .admin-section {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(30px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
  padding: 48px;
  width: 100%;
  max-width: 480px;
  animation: float 0.8s ease-out, glow 3s ease-in-out infinite;
  transform-style: preserve-3d;
  position: relative;
  margin: auto;
}

.login-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 24px;
  padding: 2px;
  background: linear-gradient(135deg, var(--primary), var(--accent), var(--primary));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.login-box:hover::before {
  opacity: 1;
  animation: borderRotate 3s linear infinite;
}

@keyframes borderRotate {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes float {
  from {
    opacity: 0;
    transform: translateY(30px) rotateX(10deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow:
      0 30px 80px rgba(0, 0, 0, 0.6),
      0 0 0 1px rgba(255, 255, 255, 0.05),
      0 0 60px rgba(99, 102, 241, 0.2);
  }
  50% {
    box-shadow:
      0 30px 80px rgba(0, 0, 0, 0.6),
      0 0 0 1px rgba(255, 255, 255, 0.05),
      0 0 80px rgba(6, 182, 212, 0.3);
  }
}

.login-box h1, .admin-section h2 {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  text-align: center;
  animation: titleShine 3s ease-in-out infinite;
}

@keyframes titleShine {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.login-box p {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
  font-size: 15px;
}

.form-group {
  margin-bottom: 24px;
  animation: slideIn 0.6s ease-out backwards;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.form-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  transition: color 0.2s ease;
}

.form-group:focus-within label {
  color: var(--primary-light);
}

.form-group input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(15, 23, 42, 0.5);
  color: var(--text);
  font-family: inherit;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px var(--glow),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
  background: rgba(15, 23, 42, 0.8);
}

/* Custom date input styling */
input[type="date"] {
  position: relative;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0px;
  background: rgba(15, 23, 42, 0.6);
  border: 2px solid var(--border);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  padding: 14px 18px;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="%2394a3b8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>') no-repeat center;
  cursor: pointer;
  width: 20px;
  height: 20px;
  transition: all 0.2s ease;
  opacity: 0.7;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  transform: scale(1.1);
}

input[type="date"]:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px var(--glow),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
  background: rgba(15, 23, 42, 0.8);
  color: var(--primary-light);
  transform: translateY(-2px);
}

.form-group input[type="date"] {
  width: 100%;
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  width: 100%;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 36px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(-1px) scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--primary-light);
  border: 2px solid var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-delete {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
}

.btn-delete:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5);
}

/* Dashboard with 3D cards */
.dashboard-container {
  padding: 24px 0;
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; filter: blur(10px); }
  to { opacity: 1; filter: blur(0); }
}

.dashboard-header {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(30px) saturate(150%);
  padding: 36px 48px;
  border-radius: 20px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: slideDown 0.8s ease-out;
  position: relative;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-header h1 {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.stat-card {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(30px) saturate(150%);
  padding: 32px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  animation: cardPop 0.6s ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes cardPop {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(30px);
  }
  50% {
    transform: scale(1.05) translateY(-5px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: -1;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  box-shadow: 0 0 20px var(--glow);
}

.stat-card:hover {
  transform: translateY(-12px) rotateX(5deg) scale(1.03);
  box-shadow:
    0 25px 60px rgba(99, 102, 241, 0.3),
    0 0 80px rgba(99, 102, 241, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: var(--primary-light);
}

.stat-card:hover::before {
  opacity: 0.1;
}

.stat-card h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.stat-card .value {
  font-size: 40px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--text), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
  text-shadow: 0 0 40px var(--glow);
}

.date-filter {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(30px) saturate(150%);
  padding: 32px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  margin-bottom: 48px;
  animation: cardPop 0.6s ease-out 0.2s backwards;
}

.date-filter h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 24px;
}

.date-inputs .form-group {
  margin-bottom: 0;
}

#applyDateRange {
  margin-top: 24px;
  margin-bottom: 32px;
  width: 100%;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.chart-card {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(30px) saturate(150%);
  padding: 32px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: cardPop 0.6s ease-out 0.3s backwards;
  transition: all 0.4s ease;
}

.chart-card:hover {
  transform: translateY(-8px);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(99, 102, 241, 0.2);
}

.chart-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

.table-container {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(30px) saturate(150%);
  padding: 32px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
  animation: cardPop 0.6s ease-out 0.4s backwards;
}

.table-container h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  color: var(--text);
  padding: 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

thead th:first-child {
  border-top-left-radius: 12px;
}

thead th:last-child {
  border-top-right-radius: 12px;
}

tbody tr {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tbody tr:hover {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(6, 182, 212, 0.1));
  transform: translateX(8px) scale(1.01);
  box-shadow: -4px 0 20px rgba(99, 102, 241, 0.3);
}

tbody td {
  padding: 16px;
  font-size: 14px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.error-message, .success-message {
  padding: 16px 24px;
  border-radius: 12px;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 600;
  animation: shake 0.5s ease;
  border: 1px solid;
  backdrop-filter: blur(10px);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.error-message {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: var(--danger);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.success-message {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: var(--success);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

/* Admin */
.admin-container {
  display: block;
  padding: 40px 0;
}

.admin-header {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(30px) saturate(150%);
  padding: 36px 48px;
  border-radius: 20px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: slideDown 0.8s ease-out;
}

.admin-header h1 {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-section {
  max-width: 100%;
  margin-bottom: 32px;
  animation: cardPop 0.6s ease-out backwards;
}

.admin-section:nth-child(2) { animation-delay: 0.1s; }
.admin-section:nth-child(3) { animation-delay: 0.2s; }

#loginSection {
  max-width: 480px;
  margin: 0 auto;
}

/* Responsive */
@media (max-width: 1400px) {
  .container {
    max-width: 1200px;
  }

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

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

  .date-inputs {
    grid-template-columns: 1fr;
  }

  #applyDateRange {
    margin-top: 16px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .login-box, .admin-section {
    padding: 32px 24px;
    max-width: 100%;
  }

  .dashboard-header, .admin-header {
    padding: 24px 20px;
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .dashboard-header h1, .admin-header h1 {
    font-size: 24px;
  }

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

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

  .date-inputs {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 12px;
  }

  thead th, tbody td {
    padding: 10px 8px;
  }

  .stat-card {
    padding: 24px;
  }

  .stat-card .value {
    font-size: 32px;
  }
}

@media (max-width: 480px) {
  .login-box, .admin-section {
    padding: 24px 20px;
    border-radius: 16px;
  }

  .login-box h1, .admin-section h2 {
    font-size: 24px;
  }

  .dashboard-header, .admin-header {
    padding: 20px 16px;
    border-radius: 16px;
  }

  .stat-card, .chart-card, .table-container, .date-filter {
    padding: 20px;
    border-radius: 16px;
  }

  .stat-card .value {
    font-size: 28px;
  }

  table {
    font-size: 11px;
  }

  thead th, tbody td {
    padding: 8px 6px;
  }
}

/* Language Switcher */
.language-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(20px);
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.language-switcher button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-transform: uppercase;
}

.language-switcher button:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
  color: var(--primary-light);
}

.language-switcher button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 20px var(--glow);
}

/* Scrollbar with glow */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 10px;
  box-shadow: 0 0 10px var(--glow);
  transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-light), var(--accent));
  box-shadow: 0 0 20px var(--glow);
}
