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

:root {
  --primary: #3cb779;
  --primary-hover: #2fa368;
  --primary-glow: rgba(60, 183, 121, 0.15);
  --bg-dark: #0b0f19;
  --bg-card: rgba(22, 30, 49, 0.75);
  --bg-card-hover: rgba(30, 41, 67, 0.9);
  --bg-nav: #161e31;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(60, 183, 121, 0.3);
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-lg: 0 20px 45px -10px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px -5px rgba(60, 183, 121, 0.4);
}

/* Base resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
}

/* App Layout */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 95%;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.logo-symbol {
  font-size: 1.8rem;
}

.logo-highlight {
  color: var(--primary);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  background: var(--primary-glow);
  border: 1px solid var(--border-glow);
  color: var(--primary);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: capitalize;
}

/* Main Container */
.main-content {
  flex: 1;
  max-width: 95%;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem 2.5rem 2rem;
}

/* Cards & Layout Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-5px);
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.card h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.btn-warning {
  background-color: #f59e0b;
  color: #000000;
  font-weight: 600;
}

.btn-warning:hover {
  background-color: #d97706;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.upload-panel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.2rem 1.25rem;
  margin-bottom: 1rem;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.upload-file-name {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-input {
  display: none;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
  width: 100%;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Redesigned Login Page */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-dark);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

/* Background grid animation */
.login-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(circle at 10% 20%, rgba(60, 183, 121, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    linear-gradient(rgba(255,255,255,0.005) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.005) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  z-index: 1;
}

.login-container {
  width: 100%;
  max-width: 1100px;
  min-height: 600px;
  background: rgba(22, 30, 49, 0.45);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  display: flex;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  overflow: hidden;
  z-index: 2;
}

.login-brand {
  flex: 1.1;
  background: linear-gradient(135deg, #0b0f19 0%, #171c2a 100%);
  padding: 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  border-right: 1px solid var(--border-color);
}

.login-brand::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 30% 30%, rgba(60, 183, 121, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.brand-content {
  position: relative;
  z-index: 2;
}

.brand-logo {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
}

.login-brand h1 {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.feat-item {
  display: flex;
  gap: 1rem;
}

.feat-icon {
  font-size: 1.5rem;
  background: rgba(255,255,255,0.03);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.05);
}

.feat-item h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.feat-item p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.login-form-side {
  flex: 0.9;
  padding: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 15, 25, 0.2);
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.login-card h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.error-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-hints {
  margin-top: 2.5rem;
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Make Login responsive on tablets/mobile */
@media (max-width: 868px) {
  .login-container {
    flex-direction: column;
    min-height: auto;
  }
  .login-brand {
    padding: 2.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .login-form-side {
    padding: 3rem 2.5rem;
  }
}

/* Canvas & Annotation View */
.annotation-container {
  display: flex;
  gap: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem;
  margin-top: 1.5rem;
}

.canvas-panel {
  flex: 1.3;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #000;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  min-height: 450px;
}

.canvas-wrapper {
  position: relative;
  max-width: 100%;
  cursor: crosshair;
}

.canvas-element {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
}

.preview-image {
  display: block;
  max-width: 100%;
  height: auto;
}

.settings-panel {
  flex: 0.7;
  display: flex;
  flex-direction: column;
}

.direction-selectors {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.direction-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.direction-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.direction-btn.active {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
}

/* Live Analytics Panel */
.analytics-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.stat-card {
  border-radius: 12px;
  padding: 1.5rem;
  color: white;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card.cars { background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); }
.stat-card.motorcycles { background: linear-gradient(135deg, #7f1d1d 0%, #ef4444 100%); }
.stat-card.buses { background: linear-gradient(135deg, #78350f 0%, #f59e0b 100%); }
.stat-card.trucks { background: linear-gradient(135deg, #064e3b 0%, #10b981 100%); }

.stat-val {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  margin-top: 0.5rem;
}

.analytics-content {
  display: flex;
  gap: 2rem;
}

.console-panel {
  flex: 1.2;
  background: #0f172a;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.console-header {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.console-output {
  background: #020617;
  border-radius: 8px;
  padding: 1rem;
  height: 350px;
  overflow-y: auto;
  font-family: 'Consolas', monospace;
  font-size: 0.85rem;
  color: #a8a29e;
  white-space: pre-wrap;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Progress bar container */
.progress-container {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  height: 10px;
  width: 100%;
  overflow: hidden;
  margin-top: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-fill {
  background: var(--primary);
  height: 100%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--primary);
}

/* Pulse Glow Keyframe */
@keyframes pulse-glow {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

.pulse {
  animation: pulse-glow 2s infinite ease-in-out;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .analytics-content {
    flex-direction: column;
  }
  .analytics-content > div {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .annotation-container {
    flex-direction: column;
  }
  .canvas-panel {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .nav-container {
    flex-direction: column;
    gap: 1rem;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
