/* Custom Styles and Glassmorphism */
body {
  background: radial-gradient(circle at center, #ffffff 0%, #eef2f3 100%) fixed;
  overflow: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Laser scan animation */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

@keyframes laser-scan {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(180px);
  }
}

.animate-laser {
  animation: laser-scan 2.5s ease-in-out infinite;
}

/* Success ring pulse */
@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.pulse-ring-success {
  animation: pulse-ring 1.5s infinite;
}

/* Error ring pulse */
@keyframes pulse-ring-err {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.pulse-ring-error {
  animation: pulse-ring-err 1.5s infinite;
}

/* Custom Premium Glassmorphism - Updated to match Login Card layout */
.glassmorphism {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 60px rgba(128, 0, 0, 0.12), 0 0 0 1px #cbd5e1 !important;
}

/* Sidebar navigation submenu hover effects */
#admin-nav a:not(.bg-\[\#800000\]):hover {
  background-color: rgba(128, 0, 0, 0.1) !important;
  color: #800000 !important;
}

#admin-nav a.bg-\[\#800000\]:hover,
#admin-nav a.bg-\[\#800000\] {
  background-color: #800000 !important;
  color: #ffffff !important;
}

/* Force white text on all maroon-background elements */
.bg-indigo-600,
.bg-\[#800000\] {
  color: #ffffff !important;
}

/* Active subtab - retain background on hover */
.subtab-active {
  background-color: rgba(128, 0, 0, 0.1) !important;
  border-color: rgba(128, 0, 0, 0.2) !important;
  color: #800000 !important;
}
.subtab-active:hover {
  background-color: rgba(128, 0, 0, 0.1) !important;
  border-color: rgba(128, 0, 0, 0.2) !important;
  color: #800000 !important;
}

.glassmorphism-light {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Sidebar Custom Theme */
.bg-sidebar-maroon {
  background-color: #800000;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(0, 0, 0, 0.08) 0px,
    rgba(0, 0, 0, 0.08) 3px,
    transparent 3px,
    transparent 8px
  );
}

.sidebar-link {
  transition: all 0.2s ease-in-out;
  border-left: 4px solid transparent !important;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-left-color: rgba(255, 255, 255, 0.2) !important;
}

.sidebar-link:hover, 
.sidebar-link:hover span, 
.sidebar-link:hover svg {
  color: #ffcc00 !important;
}

.sidebar-link:hover svg {
  stroke: #ffcc00 !important;
}

.nav-active {
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-left-color: #ffcc00 !important;
}

.nav-active, 
.nav-active span, 
.nav-active svg {
  color: #ffcc00 !important;
}

.nav-active svg {
  stroke: #ffcc00 !important;
}

#scrollToTopBtn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #800000;
  color: #ffcc00;
  padding: 0.75rem;
  border-radius: 9999px;
  box-shadow: 0 10px 15px -3px rgba(128, 0, 0, 0.3), 0 4px 6px -2px rgba(128, 0, 0, 0.15);
  border: 1px solid rgba(255, 204, 0, 0.2);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: translateY(2.5rem);
  pointer-events: none;
}

#scrollToTopBtn.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#scrollToTopBtn:hover {
  background-color: #a52a2a;
  transform: translateY(-0.25rem);
  box-shadow: 0 20px 25px -5px rgba(128, 0, 0, 0.4), 0 10px 10px -5px rgba(128, 0, 0, 0.2);
}

/* Print Overlays for ID Cards */
@media print {
  @page {
    size: 85.6mm 54mm;
    margin: 0;
  }
  
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 85.6mm !important;
    height: 54mm !important;
    background: transparent !important;
  }

  body * {
    visibility: hidden;
  }

  /* Force background graphics */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #printable-id-card, #printable-id-card * {
    visibility: visible;
  }

  #printable-id-card {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    margin: 0 !important;
    width: 85.6mm !important;
    height: 54mm !important;
    border: 1px solid #94a3b8 !important; /* Visible border for cutting or framing */
    border-radius: 0 !important; /* Best for full edge-to-edge printing */
    box-shadow: none !important;
    background-color: #ffffff !important; /* Solid fallback */
    background-image: none !important;
    color: #1e293b !important;
    padding: 5mm !important; 
    box-sizing: border-box !important;
    z-index: 9999 !important;
    transform: none !important;
  }
}

/* ==========================================
   MOBILE & TABLET RESPONSIVENESS OVERRIDES
   ========================================== */
@media (max-width: 767px) {
  /* Prevent body overflow and support fixed layout */
  html, body {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: 100% !important;
    max-width: 100% !important;
    position: fixed !important;
  }

  /* Hide visual horizontal scrollbars in mobile view */
  ::-webkit-scrollbar:horizontal {
    display: none !important;
  }

  /* Responsive Sidebar Drawer */
  #sidebar-menu {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: -264px !important;
    width: 264px !important;
    height: 100% !important;
    z-index: 50 !important;
    overflow-y: auto !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5) !important;
  }

  #sidebar-menu.open {
    transform: translateX(264px) !important;
  }

  /* Main content adjustments on mobile */
  .flex-1.flex.flex-col.h-screen.overflow-y-auto {
    height: 100vh !important;
    height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100% !important;
  }

  main.p-8 {
    padding: 1.25rem !important; /* p-5 equivalent */
  }

  /* Layout container horizontal headers wrapping */
  .flex.justify-between.items-center.bg-\[\#121420\].p-2.rounded-2xl {
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
    align-items: stretch !important;
  }
  .flex.justify-between.items-center.bg-\[\#121420\].p-2.rounded-2xl > div {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }
  .flex.justify-between.items-center.bg-\[\#121420\].p-2.rounded-2xl button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Kiosk Screen Responsive Layout */
  header.glass-light {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.25rem !important;
    padding: 1.25rem !important;
    text-align: center !important;
  }

  header.glass-light > div {
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
  }

  #live-clock {
    font-size: 1.875rem !important; /* 3xl to 2xl size */
  }

  .scan-ring {
    width: 10rem !important;
    height: 10rem !important;
  }

  .scan-ring img {
    width: 7.5rem !important;
    height: 7.5rem !important;
  }

  footer.max-w-6xl {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.25rem !important;
    align-items: center !important;
    position: relative !important;
    padding-bottom: 2rem !important;
  }

  footer.max-w-6xl a.absolute {
    position: static !important;
    margin-top: 0.5rem !important;
  }

  /* Adjust chart heights on smaller viewports */
  .h-72 {
    height: 14rem !important; /* ~224px */
  }

  .h-60 {
    height: 12rem !important; /* ~192px */
  }

  /* Make ID card preview fit on small phone viewports */
  #printable-id-card {
    padding: 1rem !important;
  }
  
  #printable-id-card h3 {
    font-size: 0.875rem !important;
  }

  #printable-id-card span.text-[10px],
  #printable-id-card span.font-mono {
    font-size: 8px !important;
  }
  
  #printable-id-card #print-barcode-lines {
    width: 4.5rem !important;
    height: 1.25rem !important;
  }

  /* Modals scale on extra small devices */
  .fixed.inset-0.p-4 {
    padding: 0.5rem !important;
  }
}

@media (max-width: 480px) {
  /* Extra mobile optimization for very small screens */
  h2.text-xl {
    font-size: 1.125rem !important; /* ~lg font size */
  }
  
  .glassmorphism {
    padding: 1rem !important;
  }
  
  /* Form responsiveness */
  input, select, button {
    font-size: 0.875rem !important;
    padding: 0.5rem 0.75rem !important;
  }
}

/* Center absolute input icons and prevent text overlapping globally */
.relative input {
  padding-left: 2.5rem !important;
}
.relative i {
  top: 50% !important;
  transform: translateY(-50%) !important;
}

/* Ensure all table cell badges display cleanly, align vertically, and never wrap or overlap */
td > span {
  display: inline-block !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
}

/* ============================================================
   LIGHT THEME AND BRAND COLOR CONTRASE OVERRIDES
   ============================================================ */
.glassmorphism {
  color: #334155 !important;
}
.glassmorphism h2,
.glassmorphism h3,
.glassmorphism h4 {
  color: #1e293b !important;
}
.glassmorphism .text-white {
  color: #1e293b !important;
}
.glassmorphism .text-slate-200 {
  color: #334155 !important;
}
.glassmorphism .text-slate-300 {
  color: #475569 !important;
}
.glassmorphism .text-slate-400 {
  color: #64748b !important;
}
/* Ensure standard form controls inside glassmorphism match light inputs */
.glassmorphism input:not([type="submit"]):not([type="button"]):not([type="checkbox"]),
.glassmorphism select,
.glassmorphism textarea {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
.glassmorphism input:focus,
.glassmorphism select:focus,
.glassmorphism textarea:focus {
  border-color: #800000 !important;
  --tw-ring-color: #800000 !important;
}
/* Table content visibility */
table th {
  color: #ffffff !important;
}
table td {
  color: #334155 !important;
}

/* Custom Login Card style matching Calendar of Activities project basis */
.login-card {
  background: #ffffff !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 60px rgba(128, 0, 0, 0.12), 0 0 0 1px #cbd5e1 !important;
  padding: 3rem 2.5rem !important;
  width: 100%;
  max-width: 450px;
}

/* Light theme overrides for legacy dark-theme modal structures */
div[id="user-modal"] > div,
div[id="print-modal"] > div,
div[id="admin-modal"] > div,
div[id="change-password-modal"] > div {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 60px rgba(128, 0, 0, 0.12) !important;
}

div[id="user-modal"] h3,
div[id="print-modal"] h3,
div[id="admin-modal"] h3,
div[id="change-password-modal"] h3 {
  color: #1e293b !important;
}

div[id="user-modal"] label,
div[id="print-modal"] label,
div[id="admin-modal"] label {
  color: #64748b !important;
}

/* Cancel buttons inside modals */
div[id="user-modal"] button[type="button"],
div[id="admin-modal"] button[type="button"] {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #e2e8f0 !important;
}
div[id="user-modal"] button[type="button"]:hover,
div[id="admin-modal"] button[type="button"]:hover {
  background-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Form inputs and select controls inside modals */
div[id="user-modal"] input,
div[id="user-modal"] select,
div[id="admin-modal"] input,
div[id="admin-modal"] select {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}
div[id="user-modal"] input::placeholder,
div[id="admin-modal"] input::placeholder {
  color: #94a3b8 !important;
}

/* Custom fully rounded badge pill */
.badge-pill {
  border-radius: 9999px !important;
}

/* Custom Tooltip Design matching basis screenshot */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 104%;
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  background-color: #121420; /* Dark slate matching theme tooltips */
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  border-width: 6px;
  border-style: solid;
  border-color: transparent #121420 transparent transparent;
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

