:root {
  --bg-color: #f8fafc;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --surface-color: #ffffff;
  --surface-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --text-color: #1e293b;
  --text-muted: #64748b;
  
  --primary-color: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.15);
  
  --danger-color: #ef4444;
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  
  --success-color: #10b981;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  
  --accent-orange: #f59e0b;
  --accent-teal: #06b6d4;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-premium: 0 20px 25px -5px rgba(15, 23, 42, 0.05), 0 10px 10px -5px rgba(15, 23, 42, 0.02);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3 { 
  color: #0f172a; 
  font-weight: 800;
  letter-spacing: -0.5px;
}
a { 
  color: var(--primary-color); 
  text-decoration: none; 
  transition: var(--transition-fast);
}
a:hover { 
  color: var(--primary-hover);
}

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

.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.15);
  position: relative;
  z-index: 10;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-logo {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 48px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.8px;
}

.sidebar-logo span.logo-icon {
  background: var(--primary-gradient);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.nav-item {
  padding: 12px 16px;
  border-radius: 10px;
  color: #94a3b8;
  cursor: pointer;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition-normal);
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #f1f5f9;
}

.nav-item.active {
  background: var(--primary-gradient);
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.main-content {
  flex: 1;
  padding: 48px;
  overflow-y: auto;
  max-width: 1400px;
  margin: 0 auto;
}

/* Auth View */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.06) 0%, rgba(248, 250, 252, 1) 90%);
  width: 100vw;
  padding: 24px;
}

.auth-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-premium);
}

.auth-card h2 {
  margin-bottom: 32px;
  text-align: center;
  font-size: 28px;
  color: #0f172a;
  letter-spacing: -0.8px;
}

/* Forms */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition-normal);
}

.form-control::placeholder {
  color: #94a3b8;
}

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

.btn {
  width: 100%;
  padding: 14px 20px;
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.btn:active {
  transform: translateY(0);
}

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

/* Dashboard Widgets */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.widget-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.widget-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-premium);
  border-color: #cbd5e1;
}

.widget-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary-color);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 26px;
}

.widget-info {
  flex: 1;
}

.widget-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.widget-value {
  font-size: 30px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

/* Utilities */
.hidden { display: none !important; }
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(79, 70, 229, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Table Styling */
.table-container {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  margin-top: 24px;
  box-shadow: var(--shadow-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: #f8fafc;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pending, .badge-open {
  background-color: rgba(245, 158, 11, 0.08);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-in_progress, .badge-in_review {
  background-color: rgba(79, 70, 229, 0.08);
  color: var(--primary-color);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.badge-done, .badge-resolved {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-skipped {
  background-color: rgba(100, 116, 139, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.2);
}

/* Detail Drawer (Slide-Over Panel) */
.drawer-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
}

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 520px;
  background-color: var(--surface-color);
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 40px rgba(15, 23, 42, 0.15);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

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

.drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.drawer-close:hover {
  color: #0f172a;
  transform: rotate(90deg);
}

.drawer-body {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* Timeline updates list */
.update-timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.update-item {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--primary-color);
  border-radius: 0 16px 16px 0;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.update-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.update-text {
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.6;
}

.update-media {
  margin-top: 14px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.update-media img {
  max-width: 100%;
  display: block;
}

/* Control buttons inside drawer */
.drawer-footer {
  padding: 24px 32px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 16px;
}

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.filter-btn {
  padding: 10px 20px;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.filter-btn.active, .filter-btn:hover {
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* Mobile Bottom Navigation Styles */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: var(--surface-color);
  border-top: 1px solid var(--border-color);
  display: none; /* Hidden on desktop */
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.05);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
  flex: 1;
  transition: var(--transition-fast);
}

.mobile-nav-item .material-icons {
  font-size: 24px;
}

.mobile-nav-item:hover, .mobile-nav-item.active {
  color: var(--primary-color);
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    display: none !important; /* Hide left sidebar on mobile */
  }
  
  .mobile-bottom-nav {
    display: flex; /* Show bottom bar */
  }
  
  .main-content {
    padding: 24px 16px;
    padding-bottom: 96px; /* Space for bottom nav */
  }
  
  .drawer {
    width: 100%;
    max-width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
  
  .recurring-grid {
    grid-template-columns: 1fr !important; /* Stack form and table */
    gap: 16px;
  }

  .table-container {
    overflow-x: auto; /* Enable scroll for tables on small screens */
  }

  .data-table th, .data-table td {
    padding: 14px 16px;
    font-size: 13px;
  }
}

/* ---- Admin Voice Assistant Styles ---- */
.voice-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.voice-overlay.active {
  display: flex;
}

.voice-wave-container {
  width: 130px; height: 130px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(99, 102, 241, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 36px;
}

.voice-wave-container::before,
.voice-wave-container::after {
  content: '';
  position: absolute;
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.3);
  animation: voiceWaveRing 2.2s ease-out infinite;
}

.voice-wave-container::after { animation-delay: 0.7s; }

.voice-wave-container .material-icons {
  font-size: 54px;
  color: #6366f1;
  animation: micBounce 1.5s ease-in-out infinite;
}

@keyframes voiceWaveRing {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(2.4); opacity: 0; }
}

@keyframes micBounce {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

.voice-status-text {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.voice-transcript-text {
  font-size: 16px;
  font-weight: 500;
  color: #94a3b8;
  text-align: center;
  min-height: 48px;
  max-width: 420px;
  line-height: 1.6;
}

.voice-cancel-btn {
  margin-top: 40px;
  padding: 14px 44px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition-normal);
}

.voice-cancel-btn:hover { 
  background: rgba(255, 255, 255, 0.12); 
  border-color: rgba(255, 255, 255, 0.25);
}

.voice-result-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 24px;
  margin-top: 24px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.voice-result-card .result-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.voice-result-card .result-msg {
  font-size: 15px;
  color: #f1f5f9;
  font-weight: 600;
  line-height: 1.6;
}

.voice-text-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  max-width: 380px;
  width: 100%;
}

.voice-text-input {
  flex: 1;
  padding: 14px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  transition: var(--transition-normal);
}

.voice-text-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.voice-text-input:focus {
  border-color: #6366f1;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.25);
}

.voice-text-send {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--primary-gradient);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.voice-text-send:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}

.voice-text-send .material-icons {
  font-size: 22px;
}

.tts-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  border: 1px solid rgba(255,255,255,0.08);
  color: #ffffff;
  padding: 14px 28px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  z-index: 2100;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 400px;
  pointer-events: none;
}

.tts-toast.show {
  transform: translateX(-50%) translateY(0);
}

.tts-toast .material-icons {
  font-size: 22px;
  color: #60a5fa;
  animation: ttsIconPulse 1.2s ease-in-out infinite;
}

@keyframes ttsIconPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* QR Code Stickers Styling */
.qr-stickers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.qr-sticker-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
}

.qr-sticker-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.qr-sticker-card img {
  width: 130px;
  height: 130px;
  margin: 16px 0;
  display: block;
}

.qr-sticker-card .sticker-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.qr-sticker-card .sticker-label {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.qr-sticker-card .sticker-field {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  width: 100%;
  text-align: left;
  padding-left: 8px;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  
  .app-container {
    display: block !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .main-content {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  
  .sidebar, .mobile-bottom-nav, .auth-card, 
  h1, p, .filter-bar, button, #btn-print-qr, #btn-admin-voice, .nav-item {
    display: none !important;
  }
  
  #tab-qr {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  #tab-qr h1, #tab-qr p, #tab-qr .auth-card {
    display: none !important;
  }
  
  #qr-results-container {
    display: block !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    background: none !important;
  }
  
  #qr-results-container h3 {
    display: none !important;
  }
  
  .qr-stickers-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 15px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
  }
  
  .qr-sticker-card {
    border: 1px dashed #777777 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    padding: 12px !important;
    color: #000000 !important;
  }
  
  .qr-sticker-card img {
    filter: grayscale(1) !important;
  }
}
