:root {
  /* Colors */
  --bg-color: #0a0a0f;
  --text-main: #f0f0f5;
  --text-muted: #8e8e9e;
  --accent-1: #4cc9f0;
  --accent-2: #7209b7;
  --accent-3: #f72585;
  
  --glass-bg: rgba(255, 255, 255, 0.02);
  --glass-bg-hover: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(76, 201, 240, 0.5);
  
  --shadow-color: rgba(0, 0, 0, 0.5);
  --shadow-glow: rgba(76, 201, 240, 0.15);
  
  --status-draft: #f8961e;
  --status-protocolled: #4cc9f0;
  --status-assigned: #7209b7;
  --status-archived: #43aa8b;
  
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 80px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Background Effects */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -2;
  animation: float 20s infinite alternate ease-in-out;
}
.glow-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(114,9,183,0.15), transparent 70%);
  top: -10%; left: -10%;
}
.glow-2 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(76,201,240,0.15), transparent 70%);
  bottom: -10%; right: -10%;
  animation-delay: -5s;
}
.glow-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(247,37,133,0.1), transparent 70%);
  top: 40%; left: 40%;
  animation-delay: -10s;
}
.noise {
  position: fixed;
  inset: 0;
  background: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
  opacity: 0.03;
  z-index: -1;
  pointer-events: none;
}

@keyframes float {
  0% { transform: translate(0, 0); }
  50% { transform: translate(50px, 30px); }
  100% { transform: translate(-30px, 60px); }
}

/* Utilities */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 var(--shadow-color);
  border-radius: 16px;
  transition: all 0.3s ease;
}
.glass:hover {
  background: var(--glass-bg-hover);
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 8px 32px 0 var(--shadow-glow);
}
.text-gradient {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hidden { display: none !important; }

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: all 0.4s ease;
}
.btn:hover::after { left: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
  color: #fff;
  box-shadow: 0 4px 15px rgba(76, 201, 240, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 201, 240, 0.5);
}
.btn-secondary {
  background: var(--glass-bg);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background: var(--glass-bg-hover);
  border-color: var(--accent-1);
}
.btn-danger {
  background: rgba(247, 37, 133, 0.1);
  color: var(--accent-3);
  border: 1px solid rgba(247, 37, 133, 0.3);
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 1rem;
  transition: all 0.3s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.2);
}
.form-control::placeholder { color: rgba(255,255,255,0.2); }

/* Layout App */
#app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid var(--glass-border);
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(20px);
  transition: width 0.3s ease;
}
.sidebar.collapsed { width: var(--sidebar-width-collapsed); }
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 40px;
  cursor: pointer;
}
.logo i {
  color: var(--accent-1);
  filter: drop-shadow(0 0 8px rgba(76,201,240,0.8));
}
.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
}
.nav-item.active {
  border-left: 3px solid var(--accent-1);
  background: linear-gradient(90deg, rgba(76,201,240,0.1), transparent);
}
.nav-item i { font-size: 1.2rem; width: 24px; text-align: center; }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 48px;
  transition: margin-left 0.3s ease;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.4s ease forwards; }
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }

/* Dashboard Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}
.stat-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}
.stat-header i {
  font-size: 1.5rem;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
}
.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, #aaa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Dashboard Charts & Lists */
.dashboard-panels {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.panel { padding: 24px; height: 100%; }
.panel-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Table */
.table-container {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}
th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tr { transition: background 0.3s ease; }
tr:hover { background: rgba(255,255,255,0.02); }
td { color: var(--text-main); }

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-draft { background: rgba(248, 150, 30, 0.1); color: var(--status-draft); border: 1px solid rgba(248, 150, 30, 0.3); }
.badge-protocolled { background: rgba(76, 201, 240, 0.1); color: var(--status-protocolled); border: 1px solid rgba(76, 201, 240, 0.3); }
.badge-assigned { background: rgba(114, 9, 183, 0.1); color: var(--status-assigned); border: 1px solid rgba(114, 9, 183, 0.3); }
.badge-archived { background: rgba(67, 170, 139, 0.1); color: var(--status-archived); border: 1px solid rgba(67, 170, 139, 0.3); }

/* Authentication Page */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
}
.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  position: relative;
}
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}
.auth-header h1 { margin-bottom: 8px; font-size: 2rem; }
.auth-header p { color: var(--text-muted); }

/* Upload Area */
.upload-zone {
  border: 2px dashed rgba(76, 201, 240, 0.3);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(0,0,0,0.2);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent-1);
  background: rgba(76, 201, 240, 0.05);
}
.upload-icon {
  font-size: 3rem;
  color: var(--accent-1);
  margin-bottom: 16px;
}

/* Document Detail */
.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}
.doc-title-wrapper h1 { margin-bottom: 8px; }
.doc-meta { display: flex; gap: 16px; color: var(--text-muted); font-size: 0.9rem; }
.doc-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  padding: 16px 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  min-width: 300px;
}
.toast-success { border-left: 4px solid var(--status-archived); }
.toast-error { border-left: 4px solid var(--accent-3); }
.toast-info { border-left: 4px solid var(--accent-1); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOutRight {
  to { transform: translateX(100%); opacity: 0; }
}

/* Modals */
.modal-container {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}
.modal-content {
  position: relative;
  z-index: 1001;
  width: 100%;
  max-width: 500px;
  padding: 32px;
  animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 20px; top: 0; bottom: 0;
  width: 2px;
  background: var(--glass-border);
}
.timeline-item {
  position: relative;
  padding-left: 56px;
}
.timeline-icon {
  position: absolute;
  left: 0; top: 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-1);
}
.timeline-content h4 { margin-bottom: 4px; }
.timeline-content p { color: var(--text-muted); font-size: 0.9rem; }
.timeline-time { font-size: 0.8rem; color: var(--accent-1); margin-top: 4px; display: block; }
