/* Bulma Custom Theme - Emerald Green */

/* Override Bulma's primary color with emerald green */
:root {
  --bulma-primary-h: 160deg;
  --bulma-primary-s: 84%;
  --bulma-primary-l: 39%;
  --bulma-primary: hsl(
    var(--bulma-primary-h),
    var(--bulma-primary-s),
    var(--bulma-primary-l)
  );
}

/* Primary button styling */
.button.is-primary {
  background-color: #10b981;
  border-color: transparent;
  color: #fff;
}

.button.is-primary:hover,
.button.is-primary.is-hovered {
  background-color: #059669;
  border-color: transparent;
  color: #fff;
}

.button.is-primary:active,
.button.is-primary.is-active {
  background-color: #047857;
  border-color: transparent;
  color: #fff;
}

/* Navbar styling */
.navbar.is-dark {
  background-color: #064e3b;
}

.navbar.is-primary {
  background-color: #10b981;
}

/* Menu styling for sidebar */
.menu-list a {
  color: #334155;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  /* margin-left removed as requested */
  display: flex !important;
  align-items: center;
  gap: 0.75rem; /* Space between icon and text */
}

/* Ensure icon size doesn't change */
.menu-list a .icon {
  flex-shrink: 0;
  width: 1.5rem;
  display: inline-flex;
  justify-content: center;
}

.menu-list a:hover {
  background-color: #f1f5f9;
  color: #10b981;
}

.menu-list a.is-active {
  background-color: #065f46;
  color: #fff;
}

.menu-label {
  background-color: #10b981; /* Inverted: green background */
  color: #ffffff; /* Inverted: white text */
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1.5rem;
  padding: 0.5rem 0.75rem; /* Added padding */
  border-radius: 0.375rem;
}

.menu-label:first-child {
  margin-top: 0;
}

/* Admin Global Menu Label */
.menu-label.menu-label-admin {
  background-color: #991b1b;
  color: #ffffff;
}

/* Sidebar background */
.sidebar {
  background-color: #f8fafc;
  border-right: 1px solid #e2e8f0;
  min-height: 100vh;
}

.sidebar.is-dark {
  background-color: #064e3b;
  border-right: 1px solid #047857;
}

/* Tag colors */
.tag.is-success {
  background-color: #10b981;
  color: #fff;
}

/* Table hover */
.table.is-hoverable tbody tr:hover {
  background-color: #f1f5f9;
}

/* Link colors */
a.has-text-primary:hover {
  color: #059669 !important;
}

/* Card shadow */
.box,
.card {
  box-shadow:
    0 1px 3px 0 rgb(0 0 0 / 0.1),
    0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* Custom utility classes */
.has-background-slate-50 {
  background-color: #f8fafc;
}

.has-text-slate-700 {
  color: #334155;
}

.has-text-slate-600 {
  color: #475569;
}

.has-text-slate-500 {
  color: #64748b;
}

/* Mobile sidebar */
@media screen and (max-width: 1023px) {
  .sidebar-mobile {
    position: fixed;
    top: 0;
    left: 0;
    width: 16rem;
    height: 100vh;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
  }

  .sidebar-mobile.is-active {
    transform: translateX(0);
  }
}

/* Sidebar transitions and collapsed state */
.sidebar {
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
  white-space: nowrap;
  /* Ensure content stays pinned to top/left */
  display: flex;
  flex-direction: column;
}

/* Collapsed state styles */
.sidebar.is-collapsed {
  width: 5rem !important;
  overflow: visible !important; /* Allow tooltips to show */
  z-index: 20; /* Ensure above main content */
}

/* Hide text in collapsed state */
.sidebar.is-collapsed .menu-label,
.sidebar.is-collapsed .menu-list a span:not(.icon),
.sidebar.is-collapsed .logo-text,
.sidebar.is-collapsed .button span:not(.icon) {
  display: none !important;
}

/* Adjust icons in collapsed state */
.sidebar.is-collapsed .menu-list a {
  justify-content: center;
  padding: 0.75rem 0.5rem;
}

.sidebar.is-collapsed .menu-list a .icon {
  margin-right: 0;
}

/* Center button icon when collapsed */
.sidebar.is-collapsed .button {
  padding: 0;
  justify-content: center;
}

.sidebar.is-collapsed .button .icon {
  margin: 0 !important;
}

/* Logo container adjustment */
.sidebar.is-collapsed .title {
  font-size: 0; /* Hide text nodes */
  display: flex;
  justify-content: center;
  padding: 0 0.5rem;
}
.sidebar.is-collapsed .title img {
  margin-right: 0 !important;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: absolute;
  top: 1.2rem;
  right: -12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  color: #64748b;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  color: #10b981;
  border-color: #10b981;
}

.sidebar.is-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

/* Responsive utilities */
.is-flex-mobile {
  display: flex;
}

@media screen and (min-width: 1024px) {
  .is-hidden-desktop {
    display: none !important;
  }
}

@media screen and (max-width: 1023px) {
  .is-hidden-mobile {
    display: none !important;
  }
}

/* Sidebar Tooltip for Collapsed State */
.sidebar.is-collapsed .menu-list li {
  position: relative;
}

.sidebar.is-collapsed .menu-list a:hover::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0.75rem; /* Space from sidebar */

  background-color: #334155; /* Slate-700 match */
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  white-space: nowrap;
  z-index: 50;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);

  display: block;
  pointer-events: none;
  animation: fadeIn 0.2s ease-in-out;
}

/* Optional: Add a small arrow */
.sidebar.is-collapsed .menu-list a:hover::before {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0.35rem;

  border-width: 6px;
  border-style: solid;
  border-color: transparent #334155 transparent transparent;
  z-index: 50;
  pointer-events: none;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* Mobile Layout Optimization */
@media screen and (max-width: 768px) {
  .section.is-admin-content {
    padding: 1rem 0.1rem !important;
  }

  /* Responsive Table Stacked */
  .table.is-responsive {
    display: block;
    width: 100%;
    border: 0;
    background-color: transparent;
  }

  .table.is-responsive thead {
    display: none;
  }

  .table.is-responsive tbody {
    display: block;
    width: 100%;
  }

  .table.is-responsive tr {
    display: block;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background-color: #fff;
    padding: 0.5rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  }

  .table.is-responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    padding: 0.75rem 0.5rem;
    text-align: right;
    min-height: 3rem;
  }

  .table.is-responsive td:last-child {
    border-bottom: 0;
    justify-content: center;
    background-color: #f8fafc;
    margin-top: 0.5rem;
    border-radius: 0 0 0.5rem 0.5rem;
    padding: 1rem 0.5rem; /* More padding for buttons area */
  }

  .table.is-responsive td:last-child .button {
    width: 100%;
    margin: 0.25rem 0 !important;
    height: 3.25rem; /* Larger touch target */
    font-weight: 600;
    display: flex;
    justify-content: center;
  }

  .table.is-responsive td:last-child .buttons {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .table.is-responsive td:last-child .buttons .button:not(:last-child) {
    margin-right: 0 !important;
    margin-bottom: 0.5rem !important;
  }

  /* Touch-friendly cards */
  .card-footer-item.button, 
  .card-footer .button {
    height: 3.5rem;
    font-weight: 600;
  }

  .is-fullwidth-mobile {
    width: 100% !important;
    height: 3.5rem !important;
    margin-bottom: 0.5rem !important;
    display: flex !important;
  }

  /* Responsive Tabs */
  .tabs.is-toggle-mobile ul {
    flex-direction: column;
    border: none;
  }

  .tabs.is-toggle-mobile li {
    width: 100%;
    margin-bottom: 0.25rem;
  }

  .tabs.is-toggle-mobile li a {
    border-radius: 4px !important;
    border: 1px solid #dbdbdb !important;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
  }

  /* Level adjustments for mobile */
  .is-mobile-stacked {
    flex-direction: column;
    align-items: stretch;
  }

  .is-mobile-stacked .level-left,
  .is-mobile-stacked .level-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .level-left + .level-right {
    margin-top: 1.5rem;
  }

  .level-item {
    width: 100%;
  }

  /* Field Addons fix for mobile */
  .field.has-addons {
    flex-wrap: wrap;
  }

  .field.has-addons .control:first-child:not(:only-child),
  .field.has-addons .control:first-child:not(:only-child) .input,
  .field.has-addons .control:first-child:not(:only-child) .select select {
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
  }

  /* Sticky Mobile Budget Summary */
  .mobile-budget-sticky {
    position: fixed;
    top: 3.25rem; /* Below the standard navbar */
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    border-bottom: 3px solid #10b981;
    z-index: 35; /* Above content, but below sidebar (40) */
    padding: 0.75rem 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
  }

  .mobile-budget-sticky.is-visible {
    display: flex;
    transform: translateY(0);
    justify-content: space-between;
    align-items: center;
  }

  .mobile-budget-sticky .budget-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
  }

  .mobile-budget-sticky .budget-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #10b981;
  }
}

/* Fix Bulma title-subtitle overlap when margin-bottom spacing helpers are used on the title */
.title[class*="mb-"] + .subtitle {
  margin-top: 0 !important;
}





