html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin-bottom: 60px;
  overflow-x: hidden;
}

/* Desktop layout: let the layout control scroll (no forced height overrides) */
@media (min-width: 1024px) {
  .lg\:ml-64 {
    overflow-x: hidden !important;
  }
  
  .lg\:ml-64 main {
    /* allow layout classes to manage scrolling */
  }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Delete Confirmation Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1050;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: 0.5rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #dee2e6;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6c757d;
  padding: 0.25rem;
  line-height: 1;
}

.close-modal:hover {
  color: #212529;
}

/* Loading spinner */
.animate-spin {
  animation: spin 1s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Success/Error Messages */
.success-message,
.error-message {
  position: fixed;
  top: 1rem;
  right: 1rem;
  left: 1rem;
  max-width: 400px;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
  margin: 0 auto;
  font-size: 0.95rem;
  line-height: 1.5;
}

@media (min-width: 640px) {
  .success-message,
  .error-message {
    left: auto;
    max-width: 380px;
  }
}

.success-message {
  background-color: rgba(25, 135, 84, 0.95);
  border-left: 4px solid #0f5132;
}

.error-message {
  background-color: rgba(220, 53, 69, 0.95);
  border-left: 4px solid #842029;
}

.success-message i,
.error-message i {
  flex-shrink: 0;
  font-size: 1.25rem;
}

.fade-out {
  opacity: 0;
  transform: translateY(-1rem) scale(0.98);
  pointer-events: none;
}

/* Animation for new messages */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-1rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.success-message:not(.fade-out),
.error-message:not(.fade-out) {
  animation: slideIn 0.3s ease-out forwards;
}
/*
 Internet Status Strip Styles */
#internet-status-strip {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#internet-status-strip svg {
    flex-shrink: 0;
}

/* Ensure proper spacing when status strip is visible */
body.has-status-strip {
    padding-top: 40px;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    #internet-status-strip {
        font-size: 12px;
        height: 35px;
    }
    
    body.has-status-strip {
        padding-top: 35px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #internet-status-strip {
        border-bottom: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #internet-status-strip {
        transition: none !important;
    }
    
    #internet-status-strip div {
        animation: none !important;
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    #internet-status-strip {
        box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    }
}


/* Hide mobile search icon on desktop (769px and above) */
@media (min-width: 769px) {
    .mobile-only-search,
    #mobile-search-icon {
        display: none !important;
    }
}

/* Show mobile search icon only on mobile (768px and below) */
@media (max-width: 768px) {
    .mobile-only-search {
        display: block;
    }
}

/* Mobile Sidebar Improvements - Apply to ALL pages */
@media (max-width: 768px) {
    aside#sidebar {
        width: 85vw !important;
        max-width: 280px !important;
    }

    aside#sidebar .p-6 {
        padding: 1rem !important;
    }

    aside#sidebar .p-4 {
        padding: 0.75rem !important;
    }

    aside#sidebar .card-title,
    aside#sidebar h1 {
        font-size: 1rem !important;
    }

    aside#sidebar .text-sm {
        font-size: 0.75rem !important;
    }

    aside#sidebar .nav-link {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.875rem !important;
    }

    aside#sidebar .nav-link svg,
    aside#sidebar .h-4 {
        width: 1rem !important;
        height: 1rem !important;
    }

    aside#sidebar .h-6 {
        width: 1.25rem !important;
        height: 1.25rem !important;
    }

    aside#sidebar .gap-3 {
        gap: 0.5rem !important;
    }

    aside#sidebar .space-y-2 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 0.375rem !important;
        margin-bottom: 0.375rem !important;
    }

    /* Logo/Brand section */
    aside#sidebar .p-2 {
        padding: 0.5rem !important;
    }

    /* Logout button */
    aside#sidebar button {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.875rem !important;
    }

    /* Ensure consistent border and background */
    aside#sidebar {
        background-color: hsl(var(--card)) !important;
        border-right: 1px solid hsl(var(--border)) !important;
    }
}

/* Mobile Header Search Bar */
@media (max-width: 1023px) {
    #mobile-header-search-bar {
        animation: slideIn 0.2s ease-out;
    }

    #mobile-header-search-bar .search-container {
        position: relative;
    }

    #mobile-header-search-bar .search-input {
        height: 2.25rem;
        font-size: 0.875rem;
    }

    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateX(-10px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}
