/* General body styling */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  background-color: #f8f9fa; /* Bootstrap bg-light */
}

/* --- Authentication View Styling --- */

/* When the body has the 'auth-view' class, HIDE these elements */
body.auth-view .navbar-collapse,
body.auth-view .navbar-toggler,
body.auth-view .navbar .d-flex.align-items-center {
    display: none !important;
}

/* When the user IS logged in, hide the redundant "myBusiness Home" nav link */
body:not(.auth-view) .nav-item[data-nav-item-for="myBusinessHome"] {
    display: none;
}

/* We can also hide the hamburger toggler button itself on auth pages */
body.auth-view .navbar-toggler {
    display: none !important;
}

/* Ensure the brand logo is always visible and centered when other items are gone */
body.auth-view .navbar-brand {
    margin-right: auto !important;
    margin-left: auto !important;
}

/* When the user IS logged in, hide the redundant "myBusiness Home" nav link */
body:not(.auth-view) .nav-item[data-nav-item-for="myBusinessHome"] {
    display: none;
}

/* Custom scrollbar styling for Webkit browsers */
::-webkit-scrollbar {
  width: 8px; /* Width of vertical scrollbar */
  height: 8px; /* Height of horizontal scrollbar */
}
::-webkit-scrollbar-track {
  background: #f1f1f1; /* Track color */
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: #adb5bd; /* Scrollbar thumb color (Bootstrap gray-500) */
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #6c757d; /* Thumb color on hover (Bootstrap gray-600) */
}

/* Enhance navbar links to appear more like distinct buttons */
.navbar .nav-link {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem; /* rounded-md equivalent */
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
  display: flex; /* For aligning icon and text */
  align-items: center;
}
/* Style for active navigation link */
.navbar .nav-link.active {
  background-color: #e9ecef; /* Lighter primary color, like Bootstrap's primary-100 */
  color: #0d6efd; /* Bootstrap primary color */
  font-weight: 500; /* Medium font weight */
}
/* Hover effect for non-active navigation links */
.navbar .nav-link:hover:not(.active) {
  background-color: #f8f9fa; /* Light background on hover */
  color: #212529; /* Darker text on hover */
}
/* Margin for icons within nav links */
.navbar .nav-link i {
  margin-right: 0.35rem;
}


/* Styling for custom bar chart bars (used with Bootstrap progress bars) */
.simple-bar-chart-bar {
  /* Height is controlled by Bootstrap's .progress class or inline style in JS */
  border-top-right-radius: 0.375rem; /* Rounded corners on the right side */
  border-bottom-right-radius: 0.375rem;
  transition: width 0.3s ease-in-out; /* Smooth animation for width changes */
  display: flex; /* For aligning text inside the bar */
  align-items: center;
  overflow: hidden; /* To keep text within bar boundaries */
}
.simple-bar-chart-bar:hover {
  opacity: 0.8; /* Slight transparency on hover */
}

/* Styling for Bill of Materials (BOM) items in the product form */
.bom-item {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* Spacing between elements (like space-x-2 in Tailwind) */
  padding: 0.5rem; /* Padding inside each BOM item (like p-2) */
  background-color: #f8f9fa; /* Light gray background (like bg-gray-50) */
  border-radius: 0.375rem; /* Rounded corners (like rounded-md) */
  margin-bottom: 0.5rem; /* Space below each BOM item */
  border: 1px solid #dee2e6; /* Standard border */
}
.bom-item > div {
  flex-grow: 1; /* Allow select/input fields to take available space */
}
.bom-item .form-select, .bom-item .form-control {
  font-size: 0.875rem; /* Smaller font size for form elements within BOM items */
  /* Padding is handled by Bootstrap form control classes */
}

/* Styling for product image preview in the product form */
#productImagePreview {
  border: 1px solid #dee2e6; /* Standard border */
  border-radius: 0.25rem; /* Slightly rounded corners */
}

/* Status Badge Customizations */
.status-badge {
    /* Bootstrap .badge class provides base styling. These are for specific background/text colors. */
}
.status-in-stock { background-color: #d1e7dd !important; color: #0f5132 !important; } 
.status-low-stock { background-color: #fff3cd !important; color: #664d03 !important; } 
.status-out-of-stock { background-color: #f8d7da !important; color: #842029 !important; } 
.status-idle-stock { background-color: #cff4fc !important; color: #055160 !important; } 

/* Ensure action dropdown menus in tables have sufficient width and popper config */
.action-dropdown-menu {
    min-width: 180px; 
}
.dropdown-toggle[data-bs-popper-config] { /* Ensure popper can break out of table scroll */
    /* No specific style needed here, attribute handles behavior */
}

/* --- Brand Logo Styling --- */
.navbar-brand .brand-text {
  font-weight: 1200; /* Bold text */
  color: #0d6efd;   /* Standard Bootstrap primary blue, or your chosen blue */
  font-size: 1.25rem; /* A bit larger than default text */
}

/* Hover effect for dashboard summary cards */
.card.summary-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; 
}
.card.summary-card:hover:not([disabled]) { /* Only apply hover if not effectively disabled */
    transform: translateY(-5px); 
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; 
    cursor: pointer;
}
.card.summary-card[data-action]:not([data-action=""]):hover {
    cursor: pointer;
}


/* Table styling adjustments */
.table-responsive {
    overflow-x: auto; 
}
.table th {
    white-space: nowrap; 
}
.table td {
    vertical-align: middle; 
}

/* Styling for sections within the detail view modal */
.detail-section {
    background-color: #f8f9fa; 
    padding: 1rem; 
    border-radius: 0.375rem; 
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); 
    margin-bottom: 1.5rem; 
}
.detail-section h5.h6 { 
    font-size: 1.1rem; 
    font-weight: 600; 
    color: #343a40; 
    margin-bottom: 0.75rem; 
    border-bottom: 1px solid #dee2e6; 
    padding-bottom: 0.5rem; 
}
.detail-section p, .detail-section li {
    font-size: 0.9rem; 
    color: #495057; 
}
.detail-section strong {
    color: #212529; 
}
.detail-notes {
    background-color: #fff; 
    padding: 0.75rem;
    border: 1px solid #ced4da; 
    border-radius: 0.25rem; 
    white-space: pre-wrap; 
    font-size: 0.875rem; 
}
.history-table-container {
    max-height: 260px; 
    overflow-y: auto; 
}
.history-table-container .table thead th { 
    position: sticky;
    top: 0; 
    z-index: 1; 
    background-color: #e9ecef; 
}

/* User Profile Sidebar Styling */
#profileOffcanvas .offcanvas-header {
    background-color: #0d6efd; 
    color: white;
}
#profileOffcanvas .offcanvas-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%); 
}
#profileOffcanvas .offcanvas-title i {
    font-size: 1.5rem;
}

#profileOffcanvasBody .user-info-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}
#profileOffcanvasBody .user-info-section .info-item {
    margin-bottom: 0.5rem;
}
#profileOffcanvasBody .user-info-section .info-label {
    font-weight: 500;
    color: #6c757d; 
}
#profileOffcanvasBody .user-info-section .info-value {
    font-weight: 600;
    color: #212529;
}
#profileOffcanvasBody .subscription-status-active {
    color: #198754; 
    font-weight: bold;
}
#profileOffcanvasBody .subscription-status-inactive {
    color: #dc3545; 
    font-weight: bold;
}

#logoutBtn, #updateProfileBtnSidebar {
    width: 100%;
    margin-top: 0.5rem;
}

/* Authentication Page Styles */
.auth-form-container {
    max-width: 480px; /* Slightly wider for more fields */
    margin: 2rem auto; /* More space from top */
    padding: 2rem;
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}
.auth-form-container .form-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #0d6efd;
}
.auth-form-container .form-control {
    margin-bottom: 1rem;
}
.auth-form-container .btn-primary,
.auth-form-container .btn-success,
.auth-form-container .btn-secondary {
    width: 100%;
    margin-bottom: 0.5rem; /* Space between buttons */
}
.auth-form-container .auth-switch-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Footer Styling */
#appFooter {
  background-color: #343a40; /* Dark background */
  color: #f8f9fa; /* Light text */
  padding: 1rem 0; /* More padding */
  font-size: 0.875rem; /* Smaller font */
  margin-top: auto; /* Pushes footer to bottom with flex body */
}
#appFooter .brand {
    font-weight: bold;
    color: #0d6efd; /* Primary color for brand name in footer */
}

/* Help Button */
#helpButton {
    /* Basic styling, can be enhanced */
}

/* Form error messages within modals */
.modal-body .form-error-message {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    color: var(--bs-danger-text-emphasis); /* Using Bootstrap variable for consistency */
    background-color: var(--bs-danger-bg-subtle);
    border-color: var(--bs-danger-border-subtle);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
}

/* myBusiness Home Page Styles */
.mybusiness-home-container {
    padding: 2rem;
}
.app-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
}
.app-card .card-title i {
    font-size: 1.5rem; /* Larger icons for app cards */
}
.app-card .stretched-link:hover {
    text-decoration: none; /* Prevent underline on hover for better card feel */
}


/* User Profile Update Modal */
#userProfileUpdateModal .modal-body {
    /* Add specific styling if needed */
}

/* Make global action buttons smaller on smaller screens */
@media (max-width: 768px) {
    #globalAddProductBtn, #globalAddRawMaterialBtn, #helpButton {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    .navbar-brand {
        font-size: 1.5rem; /* Slightly smaller brand on small screens */
    }
}