/* Dialogs/modals: ensure they sit above sidebar (z-10) and all content */
.fixed.inset-0[class*="bg-black"],
.fixed.inset-0[class*="bg-gray-800"] {
  z-index: 9999 !important;
}

/* ============================================
   SHADCN-STYLE SELECT & OPTION
   ============================================
   Native select/option styled like shadcn/ui:
   - Trigger: h-10, rounded-md, border-input, custom chevron
   - Options: cleaner appearance where browser allows
*/

select {
  display: flex;
  align-items: center;
  height: 2.5rem;
  width: 100%;
  padding-left: 0.75rem;
  padding-right: 2rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #0a0a0a;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23717171' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1rem 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select:hover {
  border-color: #d1d5db;
}

select:focus {
  outline: none;
  border-color: #e5e7eb;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #f3f4f6;
}

select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Option styling (supported in most modern browsers) */
select option {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  background-color: #fff;
  color: #0a0a0a;
}

select option:checked {
  background-color: #f4f4f5;
  font-weight: 500;
}

/* Force custom chevron on selects that have bg-white (e.g. in modals) so Tailwind doesn't override */
select.select-chevron {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23717171' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.5rem center !important;
  background-size: 1rem 1rem !important;
  padding-right: 2rem !important;
}

.green-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid #22c55e;
    background: #22c55e;
    display: inline-block;
    position: relative;
    cursor: pointer;
    transition: box-shadow 0.2s;
    vertical-align: middle;
  }

  .green-checkbox:checked {
    background: #22c55e;
    border-color: #22c55e;
  }

  .green-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.35rem;
    height: 0.7rem;
    border: solid #fff;
    border-width: 0 0.18rem 0.18rem 0;
    transform: translate(-50%, -60%) rotate(45deg);
    pointer-events: none;
    display: block;
  }

  .green-checkbox:not(:checked) {
    background: #fff;
  }

  .green-checkbox:focus {
    outline: 2px solid #22c55e;
    outline-offset: 1px;
  }

.rating-radio {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #D1D5DB;
  border-radius: 50%;
  background: #fff;
  outline: none;
  cursor: pointer;
  position: relative;
  margin: 0;
  flex-shrink: 0;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.rating-radio:checked {
  border-color: #22c55e;
}

.rating-radio:checked::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
}

.rating-radio:focus {
  outline: 2px solid #22c55e;
  outline-offset: 1px;
}

/* ============================================
   SIDEBAR ANIMATIONS
   ============================================ */

/* Mobile: slide panel + overlay fade */
.sidebar-panel-transition {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (min-width: 768px) {
  .sidebar-panel-transition {
    transition: width 0.2s ease-in-out;
  }
}

.sidebar-overlay-transition {
  transition: opacity 0.18s ease-in-out;
}
.sidebar-overlay-transition.sidebar-overlay-visible {
  opacity: 1;
}

/* Nav link hover/active animation */
#sidebar nav a,
#sidebar nav button {
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
#sidebar nav a:active,
#sidebar nav button:active {
  transform: scale(0.98);
}

/* Collapse: smooth text/icon visibility */
body.sidebar-collapsed .sidebar-menu-text,
body.sidebar-collapsed .sidebar-profile-text {
  transition: opacity 0.15s ease-out;
}

/* Sidebar collapse styles - Grid Layout Compatible */
/* Note: Class is applied to body element, not sidebar */

body.sidebar-collapsed .sidebar-menu-text {
  display: none !important;
}

body.sidebar-collapsed .sidebar-profile-text {
  display: none !important;
}

body.sidebar-collapsed #profile-info-expanded {
  display: none !important;
}

body.sidebar-collapsed #logout-btn-expanded {
  display: none !important;
}

body.sidebar-collapsed #profile-menu-trigger {
  display: flex !important;
}

body.sidebar-collapsed nav a,
body.sidebar-collapsed nav button {
  justify-content: center;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

body.sidebar-collapsed .hidden.md\:flex {
  padding-left: 1rem;
  padding-right: 1rem;
}

body.sidebar-collapsed .hidden.md\:flex a {
  justify-content: center;
}

body.sidebar-collapsed .hidden.md\:flex img {
  margin: 0 auto;
}

body.sidebar-collapsed .px-4.py-6.border-t {
  padding-left: 1rem;
  padding-right: 1rem;
}

body.sidebar-collapsed .px-4.py-6.border-t .flex.items-center {
  justify-content: center;
}

/* Profile context menu styles */
#profile-context-menu {
  min-width: 180px;
  white-space: nowrap;
  left: 100% !important;
  right: auto !important;
  margin-left: 0.5rem;
  margin-right: 0;
}

body.sidebar-collapsed #profile-context-menu {
  left: 100% !important;
  right: auto !important;
  margin-left: 0.5rem;
  margin-right: 0;
}

#profile-menu-chevron {
  transition: transform 0.2s ease;
}

body.sidebar-collapsed .hidden.md\:flex {
  flex-direction: column;
  align-items: center;
  padding-left: 1rem;
  padding-right: 1rem;
  gap: 0.5rem;
}

body.sidebar-collapsed .hidden.md\:flex a {
  width: 100%;
  justify-content: center;
}

body.sidebar-collapsed #sidebar-collapse-btn {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0.75rem !important;
}

body.sidebar-collapsed #sidebar-logo-section {
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  padding-top: 1.5rem !important;
  padding-bottom: 1rem !important;
  justify-content: center !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
}

body.sidebar-collapsed #sidebar-logo-link {
  justify-content: center !important;
  width: 100% !important;
  gap: 0 !important;
  margin: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
}

body.sidebar-collapsed #sidebar-logo-link > * {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

body.sidebar-collapsed #sidebar-logo-link.space-x-2 > * + * {
  margin-left: 0 !important;
}

/* ============================================
   GLOBAL FOCUS RING REMOVAL
   Removes all focus rings, outlines, and box-shadows
   from form elements and interactive components
   ============================================ */

/* Universal focus ring removal - no outline/ring, no layout shift */
*:focus,
*:focus-visible,
*:focus-within {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  --tw-ring-offset-shadow: 0 0 #0000 !important;
  --tw-ring-shadow: 0 0 #0000 !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
}

/* Remove focus rings from all form inputs */
input:focus,
input:focus-visible,
input:focus-within,
textarea:focus,
textarea:focus-visible,
textarea:focus-within,
select:focus,
select:focus-visible,
select:focus-within {
  outline: none !important;
  box-shadow: none !important;
  --tw-ring-offset-shadow: 0 0 #0000 !important;
  --tw-ring-shadow: 0 0 #0000 !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
  border-width: 1px !important;
}

/* Remove focus rings from radio buttons and checkboxes (except rating-radio) */
input[type="radio"]:not(.rating-radio):focus,
input[type="radio"]:not(.rating-radio):focus-visible,
input[type="checkbox"]:not(.green-checkbox):focus,
input[type="checkbox"]:not(.green-checkbox):focus-visible {
  outline: none !important;
  box-shadow: none !important;
  --tw-ring-offset-shadow: 0 0 #0000 !important;
  --tw-ring-shadow: 0 0 #0000 !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
}

/* Remove focus rings from buttons/links - no layout shift */
/* button:focus,
button:focus-visible,
button:focus-within,
a:focus,
a:focus-visible,
a:focus-within,
[role="button"]:focus,
[role="button"]:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  --tw-ring-offset-shadow: 0 0 #0000 !important;
  --tw-ring-shadow: 0 0 #0000 !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
} */

/* Remove Tailwind focus ring utility classes */
.focus\:ring-0:focus,
.focus\:ring-1:focus,
.focus\:ring-2:focus,
.focus\:ring-4:focus,
.focus\:ring-green-500:focus,
.focus\:ring-blue-500:focus,
.focus\:ring-red-500:focus,
.focus\:ring-gray-500:focus,
.focus-within\:ring-0:focus-within,
.focus-within\:ring-1:focus-within,
.focus-within\:ring-2:focus-within,
.focus-within\:ring-4:focus-within,
.focus-within\:ring-green-500:focus-within,
.focus-within\:ring-blue-500:focus-within {
  --tw-ring-offset-shadow: 0 0 #0000 !important;
  --tw-ring-shadow: 0 0 #0000 !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
  box-shadow: none !important;
  border-width: 1px !important;
}

/* Hide number input spinner arrows (Chrome, Safari, Edge) - no steppers */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
}
input[type="number"] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* Ensure single border on all inputs (no double borders) */
input,
textarea,
select {
  border-width: 1px !important;
}

/* Remove double borders on focus */
input:focus,
textarea:focus,
select:focus {
  border-width: 1px !important;
  box-shadow: none !important;
}

/* Calendar picker specific - remove focus rings */
.custom-datepicker select:focus,
.custom-datepicker button:focus,
.custom-datepicker input:focus {
  outline: none !important;
  box-shadow: none !important;
  --tw-ring-offset-shadow: 0 0 #0000 !important;
  --tw-ring-shadow: 0 0 #0000 !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
}

/* Keep custom focus styles for green-checkbox and rating-radio */
/* Use highly specific selectors to ensure these styles override the general rules */
input[type="radio"].rating-radio:focus,
input.rating-radio[type="radio"]:focus,
.rating-radio[type="radio"]:focus,
label input.rating-radio:focus,
label input[type="radio"].rating-radio:focus,
input[type="radio"].rating-radio:focus-visible,
input.rating-radio[type="radio"]:focus-visible,
.rating-radio[type="radio"]:focus-visible,
label input.rating-radio:focus-visible,
label input[type="radio"].rating-radio:focus-visible {
  outline: 0px solid #22c55e !important;
  outline-offset: 0px !important;
  box-shadow: none !important;
  --tw-ring-offset-shadow: 0 0 #0000 !important;
  --tw-ring-shadow: 0 0 #0000 !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
}

.green-checkbox:focus,
.green-checkbox:focus-visible {
  outline: none solid #22c55e !important;
  outline-offset: 0px !important;
  box-shadow: none !important;
  --tw-ring-offset-shadow: 0 0 #0000 !important;
  --tw-ring-shadow: 0 0 #0000 !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
}