/* Hardcoded dark theme colors - no light/dark mode switching */
:root {
  --background: 210 50% 7%;
  --foreground: 200 40% 95%;
  --card: 215 40% 10%;
  --card-foreground: 200 40% 95%;
  --muted: 217 35% 15%;
  --muted-foreground: 215 15% 60%;
  --primary: 195 100% 54%;
  --primary-foreground: 210 50% 7%;
  --secondary: 142 76% 55%;
  --secondary-foreground: 210 50% 7%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 200 40% 95%;
  --border: 217 35% 18%;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  margin: 0;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
}

/* Background image with translucent overlay */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url('/images/bg-city.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  }

.app-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.93), rgba(30, 58, 95, 0.90));
}

.bg-background { background-color: hsl(var(--background)); }
.bg-card { background-color: hsl(var(--card)); }
.bg-muted { background-color: hsl(var(--muted)); }
.text-foreground { color: hsl(var(--foreground)); }
.text-muted-foreground { color: hsl(var(--muted-foreground)); }
.text-primary { color: hsl(var(--primary)); }
.text-secondary { color: hsl(var(--secondary)); }
.text-destructive { color: hsl(var(--destructive)); }
.border-border { border-color: hsl(var(--border)); }

/* Buttons: visible focus + active feedback */
button:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}
#searchBtn:active {
  background-color: hsla(var(--primary), 0.15);
  transform: translateY(1px);
}
#searchBtn:focus-visible {
  box-shadow: 0 0 0 2px hsla(var(--primary), 0.35);
}

/* Ensure visible box for Search button in filter bar */
#searchBtn {
  border: 1px solid hsl(var(--primary));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.12s ease;
}
#searchBtn:hover {
  box-shadow: 0 10px 30px hsla(var(--primary), 0.35);
  filter: brightness(1.03);
}
#searchBtn:active {
  transform: translateY(1px);
}
/* Enhanced UI for logs page (non-DataTable) */
.glass-card {
  border: 1px solid hsl(var(--border));
  background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.05));
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(0,0,0,0.25);
}
/* Filters grid removed - using Tailwind grid classes directly */
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label-sm {
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.01em;
}
.pill-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.pill-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsla(var(--primary), 0.25);
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: 1px solid hsl(var(--primary));
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.12s ease;
}
.btn-primary:hover {
  box-shadow: 0 10px 30px hsla(var(--primary), 0.35);
  filter: brightness(1.03);
}
.btn-primary:active {
  transform: translateY(1px);
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  background: hsla(var(--muted), 0.3);
  transition: background-color 0.12s ease, transform 0.12s ease;
}
.btn-ghost:hover {
  background: hsla(var(--muted), 0.5);
}
.btn-ghost:active {
  transform: translateY(1px);
}
.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: hsla(var(--primary), 0.12);
  color: hsl(var(--primary));
  font-weight: 600;
  font-size: 12px;
  border: 1px solid hsla(var(--primary), 0.2);
}

/* Clickable error rows in Dashboard */
.error-row {
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  border-left: 3px solid transparent;
}
.error-row:hover {
  background-color: hsla(var(--primary), 0.12) !important;
  border-left-color: hsl(var(--primary)) !important;
  box-shadow: inset 0 0 0 1px hsla(var(--primary), 0.15);
}

/* DataTables uniform row heights */
#transTable tbody tr {
  height: 48px;
}
#transTable tbody td {
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
#transTable tbody td:nth-child(4), /* Directory */
#transTable tbody td:nth-child(5) { /* File Names */
  max-width: 280px;
}
#transTable tbody td:nth-child(8) { /* Error Message */
  max-width: 150px;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  font-weight: 500;
  transition: background-color 0.12s ease;
}
.btn-secondary:hover {
  background: hsla(var(--muted-foreground), 0.15);
}

/* Collapsible Sidebar */
.sidebar {
  width: 256px;
  min-width: 256px;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}

.sidebar-header {
  justify-content: space-between;
}

.sidebar-toggle {
  flex-shrink: 0;
}

.sidebar-text {
  opacity: 1;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-text {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

/* Collapsed header - center the logo icon, hide toggle */
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 0;
}

.sidebar.collapsed .sidebar-header > div:first-child {
  justify-content: center;
}

.sidebar.collapsed .sidebar-toggle {
  display: none;
}

/* Collapsed nav - clean centered icons */
.sidebar.collapsed nav {
  padding: 16px 8px;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 12px;
  gap: 0;
}

.sidebar.collapsed .nav-link i {
  margin: 0;
}

/* Collapsed user section */
.sidebar.collapsed .user-info {
  justify-content: center;
  padding: 0;
  margin-bottom: 12px;
}

.sidebar.collapsed .user-info .sidebar-text {
  display: none;
}

.sidebar.collapsed .user-info > div:first-child {
  margin: 0;
}

.sidebar.collapsed form button {
  justify-content: center;
  padding: 12px;
  gap: 0;
}

.sidebar.collapsed form button .sidebar-text {
  display: none;
}

.sidebar.collapsed .sidebar-collapse-icon {
  display: none;
}

.sidebar.collapsed .sidebar-expand-icon {
  display: block;
}

.sidebar:not(.collapsed) .sidebar-collapse-icon {
  display: block;
}

.sidebar:not(.collapsed) .sidebar-expand-icon {
  display: none;
}

/* Collapsed sidebar hover effect - subtle indicator it's expandable */
.sidebar.collapsed {
  cursor: pointer;
}

.sidebar.collapsed:hover {
  background: hsla(var(--card), 0.98);
  border-right-color: hsl(var(--primary));
}

/* Date input calendar icon - make it white */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* App container - desktop default */
.app-container {
  display: flex;
  height: 100vh;
  position: relative;
}

.main-content {
  flex: 1;
  overflow: auto;
  background: hsla(var(--background), 0.8);
  backdrop-filter: blur(8px);
}

/* Mobile header - hidden on desktop */
.mobile-header {
  display: none !important;
}

/* Mobile bottom navigation - hidden on desktop */
.mobile-nav {
  display: none !important;
}

/* Mobile breakpoint (768px and below) */
@media (max-width: 768px) {
  /* Hide desktop sidebar on mobile */
  .sidebar {
    display: none !important;
  }
  
  /* Show mobile header */
  .mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 0 16px;
    background-color: hsl(var(--card));
    background: hsl(var(--card) / 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid hsl(var(--border));
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  
  /* Adjust app container for mobile */
  .app-container {
    display: block;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 56px;  /* Space for mobile header */
    padding-bottom: 72px; /* Space for mobile nav */
  }
  
  .main-content {
    height: auto;
    min-height: calc(100vh - 56px - 72px);
    min-height: calc(100dvh - 56px - 72px);
  }
  
  /* Show mobile bottom navigation */
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background-color: hsl(var(--card));
    background: hsl(var(--card) / 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid hsl(var(--border));
    z-index: 1000;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  }
  
  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.15s ease;
  }
  
  .mobile-nav-item i,
  .mobile-nav-item svg {
    width: 24px;
    height: 24px;
  }
  
  .mobile-nav-item:hover,
  .mobile-nav-item:active {
    color: hsl(var(--foreground));
  }
  
  .mobile-nav-item.active {
    color: hsl(var(--primary));
  }
  
  .mobile-nav-item.active i,
  .mobile-nav-item.active svg {
    filter: drop-shadow(0 0 8px hsl(var(--primary) / 0.5));
  }
  
  /* Responsive page padding */
  .p-6 {
    padding: 16px !important;
  }
  
  /* Responsive headings */
  .text-3xl {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
  }
  
  /* Make glass cards more compact on mobile */
  .glass-card {
    border-radius: 12px;
  }
  
  .glass-card .p-5 {
    padding: 16px !important;
  }
  
  .glass-card .p-4 {
    padding: 12px !important;
  }
  
  /* Stack filter grids on mobile */
  .grid.grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-3,
  .grid.grid-cols-1.md\\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }
  
  /* Full width buttons on mobile */
  .btn-primary,
  .btn-ghost {
    width: 100%;
    justify-content: center;
  }
  
  /* Stack action buttons */
  .flex.flex-wrap.items-center.justify-between.gap-3 {
    flex-direction: column;
    align-items: stretch;
  }
  
  .flex.flex-wrap.items-center.justify-between.gap-3 > .flex.gap-3 {
    flex-direction: column;
  }
  
  /* Make tables horizontally scrollable */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Smaller table text on mobile */
  #transTable {
    font-size: 12px;
  }
  
  #transTable th,
  #transTable td {
    padding: 8px 12px !important;
  }
  
  /* Dashboard cards stack on mobile */
  .grid.grid-cols-1.md\\:grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  
  /* Modal responsiveness */
  .fixed.inset-0 .max-w-6xl,
  .fixed.inset-0 .max-w-2xl {
    max-width: calc(100vw - 32px) !important;
    margin: 16px;
  }
  
  .fixed.inset-0 .max-h-\\[60vh\\],
  .fixed.inset-0 .max-h-\\[50vh\\] {
    max-height: 50vh !important;
  }
  
  /* Hide export button text on mobile, show only icon */
  #exportBtn span,
  .btn-ghost span:not(:first-child) {
    display: none;
  }
  
  /* Adjust header row for mobile */
  .flex.flex-col.gap-3.md\\:flex-row.md\\:items-center.md\\:justify-between {
    gap: 12px;
  }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
  .mobile-header {
    padding: 0 12px;
  }
  
  .p-6 {
    padding: 12px !important;
  }
  
  .text-3xl {
    font-size: 1.25rem !important;
  }
  
  .mobile-nav-item {
    font-size: 10px;
  }
  
  .mobile-nav-item i {
    width: 20px;
    height: 20px;
  }
  
  /* Even more compact filter fields */
  .pill-input {
    padding: 8px 10px;
    font-size: 14px;
  }
  
  .label-sm {
    font-size: 11px;
  }
}