/* Staff CMS — custom styles (Bootstrap 5 base) */

/* Layout Transitions */
#sidebar, #page-content, .navbar {
  transition: all 0.25s ease-in-out;
}

/* Sidebar */
#sidebar {
  width: 240px;
  height: 100vh; /* Fallback */
  height: 100dvh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  z-index: 1000;
  border-right: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden; /* Main container shouldn't scroll, inner body should */
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 1rem;
}

.sidebar-body::-webkit-scrollbar {
  width: 4px;
}
.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
}

#sidebar .nav-link {
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.875rem;
  white-space: nowrap;
  margin: 0.2rem 0;
}

#sidebar .nav-link.active {
  background-color: var(--bs-primary);
  color: white !important;
}

#sidebar .nav-link:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Desktop Collapsed State */
@media (min-width: 768px) {
  .sidebar-collapsed #sidebar {
    width: 70px;
  }

  .sidebar-collapsed #sidebar .sidebar-header,
  .sidebar-collapsed #sidebar .sidebar-body,
  .sidebar-collapsed #sidebar .sidebar-footer {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  .sidebar-collapsed #sidebar .sidebar-header {
    justify-content: center;
  }

  .sidebar-collapsed #sidebar .nav-link span,
  .sidebar-collapsed #sidebar .brand-text,
  .sidebar-collapsed #sidebar .staff-meta,
  .sidebar-collapsed #sidebar .staff-info,
  .sidebar-collapsed #sidebar hr,
  .sidebar-collapsed #sidebar .staff-name {
    display: none;
  }

  .sidebar-collapsed #sidebar #sidebarToggle {
    margin: 0 !important;
  }

  .sidebar-collapsed #sidebar #userMenu {
    overflow: visible !important;
  }

  .sidebar-collapsed #sidebar .nav-link i,
  .sidebar-collapsed #sidebar .dropdown-toggle i {
    margin: 0 !important;
    font-size: 1.25rem;
  }

  .sidebar-collapsed #sidebar .nav-link,
  .sidebar-collapsed #sidebar .dropdown-toggle {
    text-align: center;
    padding: 0.8rem 0;
    justify-content: center;
  }

  .sidebar-collapsed #sidebar .dropdown-toggle::after {
      display: none;
  }
}

/* Mobile Adjustments */
@media (max-width: 767.98px) {
  #sidebar {
    width: 280px;
    position: fixed;
    height: 100dvh;
    z-index: 1045;
  }
  
  .sidebar-footer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important;
    background: var(--bs-dark);
  }
  
  .brand-logo {
    height: 28px !important;
  }
}

/* Theme-dependent icon visibility */
[data-bs-theme="light"] .d-none-light { display: none !important; }
[data-bs-theme="dark"] .d-none-dark { display: none !important; }

/* Page content */
#page-content {
  min-height: 100vh;
  background-color: var(--bs-tertiary-bg);
  width: 100%;
}

/* Top Navbar (Mobile only) */
.navbar-mobile {
  border-bottom: 1px solid var(--bs-border-color);
  background-color: var(--bs-body-bg) !important;
}

/* Timeline */
.border-start.border-2 {
  border-color: var(--bs-border-color) !important;
}

/* Cards */
.card {
  border-radius: 12px;
  border: 1px solid var(--bs-border-color-translucent);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card-header {
  border-radius: 12px 12px 0 0 !important;
  background-color: transparent;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-weight: 600;
  padding: 1rem 1.25rem;
}

/* Badges */
.badge {
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.4em 0.6em;
}

/* Tables */
.table > :not(caption) > * > * {
  padding: 1rem 1.25rem;
}

/* Font monospace smaller */
.font-monospace {
  font-size: 0.85em;
  letter-spacing: 0.05em;
}

/* Utility */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
}

/* Brand Logo */
.brand-logo {
  transition: all 0.25s ease-in-out;
  flex-shrink: 0;
  max-width: 100%;
  height: 32px;
  width: auto;
}

.sidebar-collapsed .brand-container {
  justify-content: center;
  width: 100%;
}

.sidebar-collapsed .brand-logo {
  margin-right: 0 !important;
  height: 24px; /* Slightly smaller to fit better in tight space */
}

/* Card Hover Effects */
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover, .hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Mobile Responsive Tables */
@media (max-width: 767.98px) {
  .table-responsive .table thead {
    display: none;
  }
  .table-responsive .table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--bs-card-bg);
    padding: 0.5rem;
  }
  .table-responsive .table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 0.5rem 0.75rem;
    text-align: right;
  }
  .table-responsive .table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
    margin-right: 1rem;
    color: var(--bs-secondary-color);
  }
}

[data-bs-theme="light"] .bg-success-subtle {
    background-color: #e6fcf5 !important;
}
[data-bs-theme="light"] .bg-danger-subtle {
    background-color: #fff5f5 !important;
}

/* Clean, Theme-Agnostic Action Highlights */
.request-row, .request-card {
    border-left: 4px solid transparent;
    transition: all 0.15s ease;
}

/* Approved State: Green left border, clean background */
.table-success, .bg-success-subtle {
    background-color: transparent !important; /* Keep theme background */
    border-left: 4px solid #198754 !important;
    color: inherit !important;
}

/* Cancelled State: Red left border, clean background */
.table-danger, .bg-danger-subtle {
    background-color: transparent !important; /* Keep theme background */
    border-left: 4px solid #dc3545 !important;
    color: inherit !important;
}

/* Fix text contrast inside highlighted rows - remove forced inheritance */
.table-success :not(.badge):not(button), 
.bg-success-subtle :not(.badge):not(button),
.table-danger :not(.badge):not(button), 
.bg-danger-subtle :not(.badge):not(button) {
    color: inherit !important;
}

/* Calibrated Semantic Colors for Both Themes */
.text-success, .text-success-emphasis {
    color: #2fb380 !important; /* Vibrant green visible on white and black */
}
.text-danger, .text-danger-emphasis {
    color: #f66d6d !important; /* Vibrant red visible on white and black */
}

/* --- Login Screen Modernization (Split Screen) --- */

.login-page-wrapper {
  background-color: #0a0a0a;
  overflow-x: hidden;
}

/* Brand Side Styling */
.login-brand-side {
  background-color: #0d0d0d;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-bg-glow {
  background: radial-gradient(circle at center, rgba(30,136,229,0.12) 0%, transparent 70%);
}

.mascot-container {
  z-index: 2;
  animation: float 5s ease-in-out infinite;
}

.zym-bear {
  height: auto;
  filter: url(#green-screen-mask) drop-shadow(0 20px 40px rgba(0, 0, 0, 0.7));
}

.zym-bear.desktop-only {
  max-width: 380px;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(1deg); }
}

/* Form Side Styling */
.login-form-side {
  background-color: #121212;
}

.login-card {
  background-color: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 2;
  position: relative;
}

[data-bs-theme="light"] .login-form-side {
  background-color: #f8f9fa;
}

[data-bs-theme="light"] .login-card {
  background-color: #ffffff;
}

.google-signin-btn {
  background-color: white !important;
  color: #333 !important;
  border: 1px solid #ddd !important;
  transition: all 0.2s ease;
  white-space: nowrap; /* Prevent unprofessional text wrapping */
}

.google-signin-btn:hover {
  background-color: #f8f9fa !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

[data-bs-theme="dark"] .google-signin-btn {
  background-color: #fff !important;
  color: #000 !important;
  border: none !important;
}

/* Mobile & Tablet Optimizations */
@media (max-width: 991.98px) {
  .login-page-wrapper {
    background-color: #121212;
    align-items: flex-start !important;
  }
  
  .login-form-side {
    min-height: 100vh;
    padding: 2rem 1rem !important; /* Slightly tighter side padding */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 4rem !important;
  }
  
  .mobile-mascot-header {
    z-index: 10;
    margin-bottom: -40px; 
    pointer-events: none;
    position: relative;
    /* Added subtle glow for mobile mascot */
    filter: drop-shadow(0 0 20px rgba(30,136,229,0.15));
  }

  .zym-bear.mobile-only {
    max-width: 150px; /* Refined size to ensure button fits below */
    filter: url(#green-screen-mask) drop-shadow(0 15px 30px rgba(0, 0, 0, 0.6));
    animation: float-mobile 4s ease-in-out infinite;
  }

  @keyframes float-mobile {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }

  .login-content-container {
    max-width: 420px;
    padding-top: 10px;
  }

  .login-card .login-form-content {
    padding: 2.5rem 1.5rem !important; /* Optimized padding for mobile button width */
  }

  .login-card {
    box-shadow: 0 15px 50px rgba(0,0,0,0.5) !important;
  }
}

/* ================================================
   LOGIN SCREEN ENHANCEMENTS
   ================================================ */

/* Floating theme toggle — login page only */
.login-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1100;
}

.login-theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

[data-bs-theme="dark"] .login-theme-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
}

[data-bs-theme="dark"] .login-theme-btn:hover {
  background: rgba(255,255,255,0.18);
  transform: rotate(20deg) scale(1.1);
}

[data-bs-theme="light"] .login-theme-btn {
  background: rgba(0,0,0,0.07);
  border: 1px solid rgba(0,0,0,0.1);
  color: rgba(0,0,0,0.65);
}

[data-bs-theme="light"] .login-theme-btn:hover {
  background: rgba(0,0,0,0.12);
  transform: rotate(-20deg) scale(1.1);
}

/* Light theme — form side switches, brand side stays permanently dark (mascot lives here) */
[data-bs-theme="light"] .login-page-wrapper {
  background-color: #f0f4ff;
}

[data-bs-theme="light"] .login-form-side {
  background-color: #f0f4ff;
}

/* Mobile light mode: mascot sits on dark top zone, card on light bottom zone */
@media (max-width: 991.98px) {
  [data-bs-theme="light"] .login-form-side {
    background:
      radial-gradient(ellipse 70% 32% at 50% 24%, rgba(30,136,229,0.14) 0%, transparent 100%),
      linear-gradient(to bottom, #0f0f13 0%, #0f0f13 30%, #f0f4ff 55%) !important;
  }

  /* Toggle sits over the dark zone on mobile — keep it white/glass regardless of theme */
  [data-bs-theme="light"] .login-theme-btn {
    background: rgba(255,255,255,0.16) !important;
    border: 1px solid rgba(255,255,255,0.28) !important;
    color: rgba(255,255,255,0.92) !important;
  }

  [data-bs-theme="light"] .login-theme-btn:hover {
    background: rgba(255,255,255,0.26) !important;
    transform: rotate(-20deg) scale(1.1);
  }
}

/* Richer dark form-side background — gradient mesh for glassmorphism depth */
[data-bs-theme="dark"] .login-form-side {
  background:
    radial-gradient(ellipse at 25% 65%, rgba(30,136,229,0.09) 0%, transparent 50%),
    radial-gradient(ellipse at 78% 18%, rgba(139,92,246,0.07) 0%, transparent 45%),
    #0f0f13;
}

/* Stronger brand-side glow with dual blue + purple accent */
[data-bs-theme="dark"] .brand-bg-glow {
  background:
    radial-gradient(circle at 50% 45%, rgba(30,136,229,0.22) 0%, transparent 55%),
    radial-gradient(circle at 55% 75%, rgba(139,92,246,0.10) 0%, transparent 45%);
}

/* Glassmorphism login card — dark mode */
[data-bs-theme="dark"] .login-card {
  background: rgba(22,22,28,0.72) !important;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.07) !important;
}

/* Card entrance animation */
@keyframes card-enter {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-card {
  animation: card-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Logo pop animation on load */
@keyframes logo-pop {
  0%   { transform: scale(0.75); opacity: 0; }
  65%  { transform: scale(1.06); }
  100% { transform: scale(1);    opacity: 1; }
}

.zym-logo {
  animation: logo-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s both;
}

/* Google button — touch active state + tap highlight removal */
.google-signin-btn {
  -webkit-tap-highlight-color: transparent;
}

.google-signin-btn:active {
  transform: translateY(0) scale(0.97) !important;
  box-shadow: none !important;
  transition: transform 0.08s ease !important;
}

/* Mobile mascot size increase: 150px → 200px */
@media (max-width: 991.98px) {
  .zym-bear.mobile-only {
    max-width: 200px;
  }

  .mobile-mascot-header {
    margin-bottom: -50px;
  }
}

/* Landscape phone: hide mascot, center card, enable scroll */
@media (max-width: 991.98px) and (orientation: landscape) and (max-height: 520px) {
  .mobile-mascot-header {
    display: none !important;
  }

  .login-form-side {
    justify-content: center !important;
    padding-top: 1.5rem !important;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .login-content-container {
    max-width: 400px;
    padding-top: 0 !important;
  }

  .login-card .login-form-content {
    padding: 1.5rem !important;
  }
}

/* Safe area insets — notch (top) and home bar (bottom) on iOS/Android */
@media (max-width: 991.98px) {
  .login-form-side {
    padding-top: max(4rem, calc(2rem + env(safe-area-inset-top))) !important;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .login-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Very small screens — iPhone SE and below (320–374px) */
@media (max-width: 374px) {
  .login-card .login-form-content {
    padding: 2rem 1.25rem !important;
  }

  .zym-bear.mobile-only {
    max-width: 160px;
  }

  .google-signin-btn {
    font-size: 0.875rem;
    padding: 0.6rem 1rem !important;
  }
}
