/**
 * Maestro Design System - CSS Reset
 * ========================================
 * Reset e normalize para garantir consistência cross-browser.
 */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    color: var(--text-primary);
    background-color: var(--bg-body);
    line-height: var(--line-height-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-display);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-md); }

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

a:hover {
    color: var(--text-link-hover);
}

/* Images */
img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Lists */
ul, ol {
    list-style: none;
}

/* Tables */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

/* Forms */
button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    margin: 0;
}

button {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

button:disabled {
    cursor: not-allowed;
}

input, textarea, select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

input:focus, textarea:focus, select:focus, button:focus {
    outline: none;
}

textarea {
    resize: vertical;
}

/* Remove default styling from autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-surface) inset;
    -webkit-text-fill-color: var(--text-primary);
    transition: background-color 5000s ease-in-out 0s;
}

/* Remove spinner from number inputs */
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;
}

/* Remove clear button from search inputs */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
}

/* Fieldset */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

/* Legend */
legend {
    padding: 0;
}

/* Misc */
hr {
    border: none;
    border-top: 1px solid var(--border-color-light);
    margin: var(--space-4) 0;
}

abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
}

address {
    font-style: normal;
}

/* Selection */
::selection {
    background-color: var(--color-primary-light);
    color: var(--text-primary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-gray-300) transparent;
}

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

/* Reduce motion for users who prefer it */
@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;
    }
}
