/* ============================================================================
   BovEye ML Platform - Main Stylesheet
   ============================================================================ */

/* Design Tokens */
:root {
  --sidebar-width: 200px;
  --navbar-height: 4rem;
  --transition-base: 200ms ease;

  /* Standardized Layout Tokens */
  --content-max-width: 1536px; /* max-w-screen-2xl */
  --content-padding-x: 1rem; /* px-4 */
  --content-padding-x-sm: 1.5rem; /* sm:px-6 */
  --sticky-header-z: 40;
  --sticky-actions-z: 30;
  --sticky-bottom-z: 20;
  --card-border: 1px solid hsl(var(--bc) / 0.2);
  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  --card-shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --action-bar-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

nav.fixed {
  z-index: 50;
}

/* ========== App Layout ========== */
.app-layout {
  display: flex;
  padding-top: var(--navbar-height);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: var(--navbar-height);
  height: calc(100vh - var(--navbar-height));
  width: var(--sidebar-width);
  background-color: #f9fafb;
  border-right: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-content {
  flex: 1;
  min-height: 0;
  background: #ffffff;
}

/* ========== Model Build Layout ========== */
.app-model-build-container {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--navbar-height));
}

.app-model-build-top {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.app-model-build-bottom {
  position: sticky;
  bottom: 0;
  z-index: var(--sticky-bottom-z);
  background: #ffffff;
  max-height: calc(50vh);
  overflow-y: auto;
  border-top: 2px solid #e2e8f0;
}

/* ========== Standardized Layout Components ========== */
.app-content-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding-left: var(--content-padding-x);
  padding-right: var(--content-padding-x);
}

@media (min-width: 640px) {
  .app-content-container {
    padding-left: var(--content-padding-x-sm);
    padding-right: var(--content-padding-x-sm);
  }
}

.app-sticky-header {
  position: sticky;
  top: var(--navbar-height);
  z-index: var(--sticky-header-z);
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}


.app-card-standard {
  background: #f0f0f0;
  border: 1px solid #161717;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: all var(--transition-base);
}

.app-card-standard:hover {
  background: #e6e6e8;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  border-color: #161717;
}

.app-card-form {
  background: #f0f0f0;
  border: 1px solid #161717;
  border-radius: 0.75rem;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  transition: all var(--transition-base);
}

.app-card-form:hover {
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.08);
}

.app-sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: var(--sticky-actions-z);
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.app-action-bar {
  border-radius: 0.75rem;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  padding: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.app-section-spacing {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.app-grid-standard {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .app-grid-standard {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .app-grid-standard {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

/* Project row layout variant */
.app-grid-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ========== Navbar ========== */
.navbar-custom {
  background-color: #374151;
  color: #fff;
}

.navbar-custom .btn-ghost {
  color: #fff;
}

.navbar-custom .btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* ========== Dropdown ========== */
.dropdown-content {
  background: #fff !important;
  color: #1f2937 !important;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dropdown-content .menu-title span {
  color: #374151 !important;
}

.dropdown-content li > a {
  color: #374151 !important;
}

.dropdown-content li > a:hover {
  background: #f3f4f6 !important;
  color: #1f2937 !important;
}

.dropdown-content form button {
  background: none !important;
  border: none !important;
  padding: 0.5rem !important;
  cursor: pointer !important;
}

.dropdown-content form button:hover {
  background: #f3f4f6 !important;
}

/* ========== Sidebar Navigation ========== */
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: 0.5rem;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-base);
  cursor: pointer;
}

.sidebar-nav-item:hover {
  background-color: #e5e7eb;
}

.sidebar-nav-item.active {
  background-color: #1f2937 !important;
  color: #ffffff !important;
}

.sidebar-nav-item.active svg {
  color: #ffffff !important;
  stroke: currentColor !important;
}

.sidebar-nav-item.active:hover {
  background-color: #111827 !important;
}

/* ========== Mobile Sidebar ========== */
@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
  }

  .sidebar-overlay.open {
    display: block;
  }
}

/* ========== Custom Scrollbar ========== */
.custom-scrollbar::-webkit-scrollbar,
.app-sidebar::-webkit-scrollbar,
.app-model-build-top::-webkit-scrollbar,
.app-model-build-bottom::-webkit-scrollbar {
  width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track,
.app-sidebar::-webkit-scrollbar-track,
.app-model-build-top::-webkit-scrollbar-track,
.app-model-build-bottom::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb,
.app-sidebar::-webkit-scrollbar-thumb,
.app-model-build-top::-webkit-scrollbar-thumb,
.app-model-build-bottom::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover,
.app-sidebar::-webkit-scrollbar-thumb:hover,
.app-model-build-top::-webkit-scrollbar-thumb:hover,
.app-model-build-bottom::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ========== Message System ========== */

.app-messages-sticky {
  position: fixed; /* Changed from sticky to fixed to float above all content */
  top: calc(var(--navbar-height) + 0.5rem); /* Slightly more offset from navbar */
  right: 0.01rem; /* Align to right edge with small margin */
  z-index: 60; /* Higher than navbar (50) and sidebar (50) */
  pointer-events: none; /* Prevents messages from blocking interactions */
}

#app-messages {
  max-width: 30rem; /* Reduced width for smaller appearance */
  height: auto; /* Remove fixed height to adapt to content */
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#app-messages .app-message {
  position: relative;
  border-radius: 0.375rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1rem 1rem 1rem; /* Reduced padding */
  margin-bottom: 0.5rem;
  transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.25s ease;
  height: auto;
  overflow: visible; /* Allow content to expand without clipping */
  word-break: break-word; /* Modern text wrapping, replaces overflow-wrap */
  }

#app-messages .app-message.is-dismissing {
  opacity: 0;
  transform: translateY(-8px);
  max-height: 0;
  margin-bottom: 0;
  padding: 0;
}

/* Progress countdown bar - drains left to right */
.msg-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.9); /* White background (what shows as it drains) */
  overflow: hidden;
}

.msg-progress::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  background: rgba(34, 197, 94, 0.8); /* Green fill (what disappears) */
  transform-origin: right;
  animation: progress-drain var(--duration, 4000ms) linear forwards;
}

@keyframes progress-drain {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ========== Utilities ========== */
.text-muted {
  color: #6b7280;
}


/* ========== Guidance Testing ========== */
