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

:root {
  /* Light Theme (Default) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  /* HSL Colors */
  --brand-h: 250;
  --brand-s: 70%;
  --brand-l: 55%;
  --brand: hsl(var(--brand-h), var(--brand-s), var(--brand-l));
  --brand-light: hsl(var(--brand-h), var(--brand-s), 95%);
  --brand-glow: rgba(99, 102, 241, 0.15);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.15);
  --info: #06b6d4;
  --info-glow: rgba(6, 182, 212, 0.15);
  
  /* Borders and Glass */
  --border-color: rgba(226, 232, 240, 0.8);
  --border-glow: rgba(99, 102, 241, 0.2);
  --glass-blur: 16px;
  
  /* Shadow */
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px -15px rgba(15, 23, 42, 0.12);
  
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.6);
  --bg-card-hover: rgba(17, 24, 39, 0.85);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --brand-light: hsl(var(--brand-h), var(--brand-s), 15%);
  --brand-glow: rgba(99, 102, 241, 0.3);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.4);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Background Ambient Glows */
body::before, body::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
  transition: var(--transition);
}
body::before {
  top: -100px;
  right: -50px;
  background: radial-gradient(circle, var(--brand) 0%, transparent 70%);
}
body::after {
  bottom: -100px;
  left: -50px;
  background: radial-gradient(circle, var(--info) 0%, transparent 70%);
}
[data-theme="dark"]::before {
  opacity: 0.25;
}
[data-theme="dark"]::after {
  opacity: 0.25;
}

/* Typography elements */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Navigation bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px var(--brand-glow);
}

.brand-info h1 {
  font-size: 1.25rem;
  line-height: 1.2;
}

.brand-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Mode toggles and views */
.toggle-group {
  background: var(--border-color);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  gap: 0.25rem;
}

.toggle-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: var(--transition);
}

.toggle-btn.active {
  background: var(--bg-secondary);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--brand-light);
  color: var(--brand);
  border-color: var(--brand);
}

/* Main Container Layout */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  padding-bottom: 5rem;
}

/* Cards & Glassmorphism */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  transition: var(--transition);
}

.card.primary-accent::before {
  background: linear-gradient(90deg, var(--brand) 0%, var(--info) 100%);
}

.card.danger-accent::before {
  background: linear-gradient(90deg, var(--danger) 0%, var(--warning) 100%);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

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

.form-control, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-control:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* Custom Grid Columns */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 12px var(--brand-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--brand-glow);
}

.btn-secondary {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border-color);
  color: var(--brand);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Radio Cards (Urgency Selector) */
.urgency-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.urgency-card {
  position: relative;
  cursor: pointer;
}

.urgency-card input {
  position: absolute;
  opacity: 0;
}

.urgency-card-content {
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.urgency-card-content span.title {
  font-weight: 700;
  font-size: 0.95rem;
}

.urgency-card-content span.desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Urgency Variants */
.urgency-card.normal input:checked + .urgency-card-content {
  border-color: var(--success);
  background: var(--success-glow);
  color: var(--success);
}

.urgency-card.urgent input:checked + .urgency-card-content {
  border-color: var(--warning);
  background: var(--warning-glow);
  color: var(--warning);
}

.urgency-card.critical input:checked + .urgency-card-content {
  border-color: var(--danger);
  background: var(--danger-glow);
  color: var(--danger);
}

/* Custom Tag Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50px;
  text-transform: uppercase;
}

.badge-normal { background: var(--success-glow); color: var(--success); }
.badge-urgent { background: var(--warning-glow); color: var(--warning); }
.badge-critical { background: var(--danger-glow); color: var(--danger); }

.badge-submitted { background: rgba(99, 102, 241, 0.15); color: var(--brand); }
.badge-review { background: var(--info-glow); color: var(--info); }
.badge-action { background: var(--warning-glow); color: var(--warning); }
.badge-resolved { background: var(--success-glow); color: var(--success); }

/* Dashboard Analytics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.brand { background: var(--brand-glow); color: var(--brand); }
.stat-icon.warning { background: var(--warning-glow); color: var(--warning); }
.stat-icon.success { background: var(--success-glow); color: var(--success); }
.stat-icon.danger { background: var(--danger-glow); color: var(--danger); }

.stat-info .num {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-info .label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Visualization Panel */
.chart-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Simple CSS SVG Chart styling */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  height: 320px;
}

.chart-card h4 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-content {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  position: relative;
  padding-top: 1rem;
}

/* Custom Visual Bar Chart */
.bar-chart-container {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: flex-end;
  gap: 8%;
  padding-bottom: 1.5rem;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.bar-val {
  width: 100%;
  background: linear-gradient(180deg, var(--brand) 0%, rgba(99, 102, 241, 0.4) 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 5px;
  position: relative;
  transition: height 1s ease-out;
}

.bar-col:hover .bar-val {
  filter: brightness(1.15);
}

.bar-tooltip {
  position: absolute;
  top: -25px;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
}

.bar-col:hover .bar-tooltip {
  opacity: 1;
  top: -30px;
}

.bar-label {
  position: absolute;
  bottom: -20px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* Custom Ring Chart (Burnout Index) */
.ring-chart-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.svg-ring {
  transform: rotate(-90deg);
}

.svg-ring-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 12;
}

.svg-ring-active {
  fill: none;
  stroke: url(#chart-grad);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 251.2;
  transition: stroke-dashoffset 1s ease-out;
}

.ring-value {
  position: absolute;
  text-align: center;
}

.ring-value .val {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
}

.ring-value .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.25rem;
}

/* Tabs Panel for Switching Sections */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Ticket list styling */
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.ticket-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
}

.ticket-item:hover {
  transform: translateX(4px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-sm);
}

.ticket-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.ticket-meta span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ticket-title {
  font-weight: 700;
  font-size: 1rem;
}

.ticket-body-prev {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ticket-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

/* Modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.25s ease-out;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
}

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

.modal-body {
  padding: 1.5rem;
  flex-grow: 1;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
}

/* Timeline component */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin: 1.5rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 6px;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 3px solid var(--border-color);
  z-index: 2;
  transition: var(--transition);
}

.timeline-item.completed::before {
  border-color: var(--brand);
  background: var(--brand);
}

.timeline-item.active::before {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-glow);
}

.timeline-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.timeline-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Dropzone styling */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.dropzone:hover {
  border-color: var(--brand);
  background: var(--brand-light);
}

.dropzone-icon {
  font-size: 2rem;
  color: var(--text-muted);
}

.dropzone-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Success Card styling */
.success-screen {
  text-align: center;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success-glow);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.08);
  animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ticket-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ticket-id-val {
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--brand);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
  z-index: 300;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Interactive elements */
.filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-row select, .filter-row input {
  max-width: 200px;
}

.flex-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
