/* ============================================================
   MicroCart - Vendor / Third-Party Resets
   by Thirty Third Company
   
   Minimal normalize + appearance resets + custom scrollbar
   + selection color + focus-visible outline
   ============================================================ */

/* ------------------------------------------------------------
   Minimal Normalize Reset
   Only the essential cross-browser resets
   ------------------------------------------------------------ */

/* Prevent inconsistencies in default line-height */
html {
    line-height: 1.15;
    -webkit-text-size-adjust: 100%;
}

/* Remove the margin in all browsers */
body {
    margin: 0;
}

/* Correct the font size in all browsers */
small {
    font-size: 80%;
}

/* Prevent `sub` and `sup` from affecting line-height */
sub,
sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sup {
    top: -0.5em;
}

sub {
    bottom: -0.25em;
}

/* Remove the border on images inside links in IE 10 */
img {
    border-style: none;
}

/* Correct the odd appearance in Chrome and Safari */
button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
}

/* Correct the inability to style clickable types in iOS and Safari */
button:not(:disabled),
[type="button"]:not(:disabled),
[type="reset"]:not(:disabled),
[type="submit"]:not(:disabled) {
    cursor: pointer;
}

/* Remove the inner border and padding in Firefox */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

/* Restore the focus styles unset by the previous rule */
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
    outline: 1px dotted ButtonText;
}

/* Correct the padding in Firefox */
fieldset {
    padding: 0.35em 0.75em 0.625em;
}

/* Correct the text wrapping and alignment in Edge and IE */
legend {
    box-sizing: border-box;
    color: inherit;
    display: table;
    max-width: 100%;
    padding: 0;
    white-space: normal;
}

/* Correct the cursor style of increment and decrement buttons in Safari */
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
    height: auto;
}

/* Correct the text style of placeholders in Chrome, Edge, and Safari */
::-webkit-input-placeholder {
    color: inherit;
    opacity: 0.54;
}

/* Correct the inability to style clickable types in iOS and Safari */
[type="search"] {
    -webkit-appearance: textsearchfield;
    outline-offset: -2px;
}

/* Correct the odd appearance in Chrome and Safari */
::-webkit-search-decoration {
    -webkit-appearance: none;
}

/* Correct the style in Chrome, Edge, Firefox, and Safari */
::-webkit-file-upload-button {
    -webkit-appearance: button;
    font: inherit;
}

/* Add the correct display in IE 10+ */
[hidden] {
    display: none;
}

/* Add the correct display in Edge, IE 10+, and Firefox */
details {
    display: block;
}

/* Add the correct display in all browsers */
summary {
    display: list-item;
}

/* Add the correct display in IE 10+ */
template {
    display: none;
}


/* ------------------------------------------------------------
   Appearance Resets for Inputs, Buttons, Select
   ------------------------------------------------------------ */

/* Remove default appearance from all form elements */
input,
textarea,
select,
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    margin: 0;
}

/* Number input spinners removal */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Search input reset */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

/* Range input reset */
input[type="range"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -6px;
    border: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #e4e4e7;
    border-radius: 2px;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #e4e4e7;
    border-radius: 2px;
    border: none;
}

/* Checkbox and Radio reset */
input[type="checkbox"],
input[type="radio"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 1em;
    height: 1em;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    vertical-align: middle;
}

/* Color input reset */
input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 40px;
    height: 40px;
    border: none;
    padding: 0;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Date input reset */
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"],
input[type="week"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* File input reset */
input[type="file"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0;
    border: none;
    background: transparent;
}

/* Select arrow removal (we add custom arrows in style.css) */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    text-overflow: ellipsis;
}

/* Reset textarea to not inherit default monospace font */
textarea {
    font-family: inherit;
    overflow: auto;
    vertical-align: top;
}

/* Button reset */
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    text-align: left;
    font-size: inherit;
}

/* Progress element reset */
progress {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 8px;
    border: none;
    border-radius: 4px;
    overflow: hidden;
    background: #e4e4e7;
}

progress::-webkit-progress-bar {
    background: #e4e4e7;
    border-radius: 4px;
}

progress::-webkit-progress-value {
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

progress::-moz-progress-bar {
    background: var(--primary);
    border-radius: 4px;
}

/* Meter element reset */
meter {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 8px;
    border: none;
    border-radius: 4px;
    overflow: hidden;
}

meter::-webkit-meter-bar {
    background: #e4e4e7;
    border-radius: 4px;
}

meter::-webkit-meter-optimum-value {
    background: var(--primary);
    border-radius: 4px;
}

meter::-moz-meter-bar {
    background: #e4e4e7;
    border-radius: 4px;
}


/* ------------------------------------------------------------
   Custom Scrollbar Styling
   Thin scrollbar with primary color accent
   ------------------------------------------------------------ */

/* Webkit (Chrome, Safari, Edge, Opera) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f4f4f5;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 4px;
    min-height: 32px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1aa;
}

::-webkit-scrollbar-thumb:active {
    background: #71717a;
}

/* Scrollbar corner */
::-webkit-scrollbar-corner {
    background: #f4f4f5;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #d4d4d8 #f4f4f5;
}

/* Thin scrollbar variant */
.scrollbar-thin::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 2px;
}

.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #d4d4d8 transparent;
}

/* No scrollbar variant */
.scrollbar-none::-webkit-scrollbar {
    display: none;
}

.scrollbar-none {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Custom primary-colored scrollbar */
.scrollbar-primary::-webkit-scrollbar-thumb {
    background: var(--primary-light);
}

.scrollbar-primary::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.scrollbar-primary {
    scrollbar-color: var(--primary-light) #f4f4f5;
}

/* Dark scrollbar */
.scrollbar-dark::-webkit-scrollbar-track {
    background: #27272a;
}

.scrollbar-dark::-webkit-scrollbar-thumb {
    background: #52525b;
}

.scrollbar-dark::-webkit-scrollbar-thumb:hover {
    background: #71717a;
}

.scrollbar-dark {
    scrollbar-color: #52525b #27272a;
}


/* ------------------------------------------------------------
   Selection Color
   Primary background with white text
   ------------------------------------------------------------ */
::selection {
    background-color: var(--primary);
    color: #ffffff;
}

::-moz-selection {
    background-color: var(--primary);
    color: #ffffff;
}

/* Selection on specific elements */
.text-primary::selection {
    background-color: var(--primary-dark);
    color: #ffffff;
}

.bg-primary::selection {
    background-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.bg-gray-900::selection,
.footer::selection,
.admin-sidebar::selection {
    background-color: var(--primary-ring-strong);
    color: #ffffff;
}

/* Selection on inputs */
input::selection,
textarea::selection {
    background-color: var(--primary-ring-strong);
    color: inherit;
}


/* ------------------------------------------------------------
   Focus Visible Outline
   Primary color ring for keyboard navigation
   ------------------------------------------------------------ */

/* Global focus-visible style */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Button focus */
button:focus-visible,
.btn:focus-visible,
[type="button"]:focus-visible,
[type="submit"]:focus-visible,
[type="reset"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Link focus */
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Input focus */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

/* Checkbox/Radio focus */
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Skip to content link (accessibility) */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--spacing-4);
    padding: var(--spacing-2) var(--spacing-4);
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    border-radius: var(--radius, 8px);
    z-index: 9999;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: var(--spacing-4);
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}


/* ------------------------------------------------------------
   Additional Vendor Resets
   ------------------------------------------------------------ */

/* Prevent iOS tap highlight */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Smooth font rendering */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Prevent iOS font size adjustment on orientation change */
html {
    -webkit-text-size-adjust: 100%;
}

/* Fix iOS safe area insets */
@supports (padding: max(0px)) {
    .safe-area-bottom {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }

    .safe-area-top {
        padding-top: max(0px, env(safe-area-inset-top));
    }

    .safe-area-left {
        padding-left: max(0px, env(safe-area-inset-left));
    }

    .safe-area-right {
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* Fix for 100vh issue on mobile browsers */
.h-screen,
.h-min-screen {
    height: 100vh;
    height: -webkit-fill-available;
}

/* Prevent overflow issues with position:fixed on mobile */
@supports (-webkit-touch-callout: none) {
    .modal-overlay {
        -webkit-overflow-scrolling: touch;
    }

    .drawer {
        -webkit-overflow-scrolling: touch;
    }
}

/* Picture element reset */
picture {
    display: contents;
}

/* SVG reset */
svg:not(:root) {
    overflow: hidden;
}

/* Reset for embedded content */
iframe,
embed,
object {
    border: 0;
    max-width: 100%;
}

/* Reset for abbr */
abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
    border-bottom: none;
}

/* Reset for mark */
mark {
    background-color: var(--primary-bg);
    color: var(--primary-dark);
    padding: 2px 4px;
    border-radius: 2px;
}

/* Reset for del/ins */
del {
    text-decoration: line-through;
    color: #dc2626;
    opacity: 0.75;
}

ins {
    text-decoration: none;
    color: var(--primary);
    background-color: var(--primary-ring);
}

/* Print link URLs for print */
@media print {
    a[href]::after {
        content: ' (' attr(href) ')';
        font-size: 0.75rem;
        color: #666666;
    }

    a[href^='#']::after,
    a[href^='javascript:']::after {
        content: '';
    }
}
