/**
 * Base Styles
 * Fundamental styling for body, typography, and basic elements
 */

/* Body & Layout */
body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(var(--brand-color-rgb), 0.22);
}

/* Modern thin scrollbar (WebKit/Blink — progressive enhancement, no-op elsewhere) */
::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Container */
.container {
    max-width: 1400px;
    padding: var(--spacing-lg) var(--spacing-md);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--spacing-md) 0;
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin: 0 0 var(--spacing-md) 0;
}

small {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Focus States */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Form Controls Focus */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

/* Loading Spinner */
.spinner-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-dropdown);
    border-radius: var(--border-radius-lg);
}

/* Utility Classes */
.text-muted {
    color: var(--text-muted) !important;
}

/* Bootstrap ships .text-info/.text-warning/.text-success/.text-danger/.text-secondary but has no
   equivalent for this app's own --brand-color - added so a page header/tile icon can use it the
   same way (`class="fas fa-route text-brand"`) instead of needing an inline style. */
.text-brand {
    color: var(--brand-color) !important;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

/* Must stay last among the .d-* rules above: this file's copy of Bootstrap's display
   utilities is redundant with bootstrap.min.css (loaded first) but wins ties by cascade
   order since it's !important vs !important. With .d-none declared earlier, any element
   combining e.g. "d-flex d-none" (baked-in-hidden, JS reveals by removing d-none) rendered
   visible regardless of the class actually being present - found 2026-08-14 via a real
   screenshot mismatch against a "d-flex d-none" alert banner in modules/sales-call/index.php. */
.d-none {
    display: none !important;
}

.justify-content-center {
    justify-content: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.align-items-start {
    align-items: flex-start !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

/* Margin & Padding Utilities */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-xs) !important; }
.mb-2 { margin-bottom: var(--spacing-sm) !important; }
.mb-3 { margin-bottom: var(--spacing-md) !important; }
.mb-4 { margin-bottom: var(--spacing-lg) !important; }
.mb-5 { margin-bottom: var(--spacing-xl) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--spacing-xs) !important; }
.mt-2 { margin-top: var(--spacing-sm) !important; }
.mt-3 { margin-top: var(--spacing-md) !important; }
.mt-4 { margin-top: var(--spacing-lg) !important; }
.mt-5 { margin-top: var(--spacing-xl) !important; }

.me-1 { margin-right: var(--spacing-xs) !important; }
.me-2 { margin-right: var(--spacing-sm) !important; }
.me-3 { margin-right: var(--spacing-md) !important; }

.ms-1 { margin-left: var(--spacing-xs) !important; }
.ms-2 { margin-left: var(--spacing-sm) !important; }
.ms-3 { margin-left: var(--spacing-md) !important; }

/* Responsive Utilities */
@media (max-width: 576px) {
    .container {
        padding: var(--spacing-sm);
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
}

@media (max-width: 768px) {
    .flex-column-mobile {
        flex-direction: column !important;
    }
}

/* Local copy of Bootstrap's .d-md-none, kept so it wins !important ties against later-loaded
   utilities by cascade order (same reasoning as .d-none above). Must match Bootstrap's real
   semantics: hide from the md breakpoint UP (>=768px), visible below it. This block previously
   used `max-width: 768px`, which inverted the meaning and silently killed the only consumer in
   the app - the mobile bottom tab bar (includes/layout/bottom-nav.php) - on the exact widths it
   was meant to show. Fixed 2026-08-28. */
@media (min-width: 768px) {
    .d-md-none {
        display: none !important;
    }
}