/**
 * Base Reset & Normalize
 * Consistent baseline styles across browsers
 * @reference: https://github.com/necolas/normalize.css/
 */

/* ========================================
   Box Sizing & Reset
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ========================================
   Root & Body
   ======================================== */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-gray-900);
    background-color: var(--color-gray-50);
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--space-4);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
}

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
}

/* ========================================
   Links
   ======================================== */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-base) var(--ease-in-out);
}

a:hover {
    color: var(--color-primary-light);
}

a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ========================================
   Lists
   ======================================== */
ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ========================================
   Images & Media
   ======================================== */
img,
svg,
video {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* ========================================
   Forms & Inputs
   ======================================== */
button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: inherit;
    margin: 0;
}


button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
    cursor: pointer;
}

button:disabled,
[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Remove tap highlight on mobile */
button,
a {
    -webkit-tap-highlight-color: transparent;
}

/* ========================================
   Accessibility
   ======================================== */
/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: 0;
    transform: translateY(-100%);
    left: 0;
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    z-index: var(--z-index-tooltip);
}

.skip-to-main:focus {
    transform: none;
}

/* Skip-link target: focused programmatically, so no ring on the whole page. */
#main-content:focus {
    outline: none;
}

/* ========================================
   Utility Classes
   ======================================== */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ========================================
   Animations
   ======================================== */

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Loading indicators must keep moving or they read as "stuck";
       spin slowly instead of freezing after one cycle. */
    .spinner-border,
    .spinner-grow {
        animation-duration: 1.5s !important;
        animation-iteration-count: infinite !important;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    img {
        page-break-inside: avoid;
    }

    h2, h3 {
        page-break-after: avoid;
    }

    /* App chrome: print only the page content */
    .sidebar,
    .sidebar-overlay,
    .navbar,
    .site-footer,
    .skip-to-main,
    .messages-container,
    .page-header > :last-child:not(:first-child),
    .toast-container,
    .modal,
    .btn,
    button {
        display: none !important;
    }

    body,
    body:not(.no-sidebar) {
        padding-left: 0 !important;
    }

    /* Show full tables instead of a clipped scroll area */
    .table-responsive {
        overflow: visible !important;
    }

    .content-card {
        border: 1px solid #999 !important;
    }

    /* Links print their text only; no noisy URL expansion */
    a[href]::after {
        content: none !important;
    }
}
