/**
* COMPREHENSIVE BROWSER NORMALIZATION
* Ensures identical appearance across ALL browsers
* Chrome, Firefox, Safari, Edge, Opera, Brave, etc.
*/

/* ====== CSS RESET - UNIVERSAL ====== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ====== HTML & BODY NORMALIZATION ====== */
html {
    /* Prevent font size adjustment on iOS */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;

    /* Smooth scrolling - all browsers */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;

    /* Consistent line height */
    line-height: 1.15;

    /* Consistent font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;

    /* Consistent height */
    height: 100%;
    width: 100%;
}

body {
    /* Reset margins */
    margin: 0;
    padding: 0;

    /* Consistent font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;

    /* Consistent height */
    min-height: 100vh;
    min-height: -webkit-fill-available;

    /* Consistent width */
    width: 100%;
    overflow-x: hidden;

    /* Consistent font family */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

/* ====== TYPOGRAPHY NORMALIZATION ====== */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    padding: 0;
    font-weight: inherit;
    font-size: inherit;
    line-height: 1.2;
}

p, ul, ol, li, dl, dt, dd {
    margin: 0;
    padding: 0;
}

/* ====== LINKS NORMALIZATION ====== */
a {
    text-decoration: none;
    color: inherit;
    /* Remove tap highlight on mobile */
    -webkit-tap-highlight-color: transparent;
    /* Consistent cursor */
    cursor: pointer;
}

a:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ====== IMAGES NORMALIZATION ====== */
img {
    /* Remove border */
    border: 0;

    /* Consistent display */
    display: block;
    max-width: 100%;
    height: auto;

    /* Consistent rendering */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);

    /* Prevent image dragging */
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* ====== BUTTONS NORMALIZATION ====== */
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    /* Remove default styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* Consistent border */
    border: none;
    background: none;

    /* Consistent font */
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;

    /* Remove tap highlight */
    -webkit-tap-highlight-color: transparent;

    /* Consistent cursor */
    cursor: pointer;

    /* Consistent padding */
    padding: 0;
    margin: 0;
}

button:focus,
input[type="button"]:focus,
input[type="submit"]:focus,
input[type="reset"]:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ====== FORM ELEMENTS NORMALIZATION ====== */
input,
textarea,
select {
    /* Consistent font */
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;

    /* Remove default styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* Consistent border */
    border: 1px solid #ccc;
    border-radius: 0;

    /* Consistent padding */
    padding: 0.5em;
    margin: 0;

    /* Consistent width */
    width: 100%;
    max-width: 100%;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Prevent zoom on iOS input focus */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="search"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ====== LISTS NORMALIZATION ====== */
ul, ol {
    list-style: none;
}

/* ====== TABLES NORMALIZATION ====== */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

th, td {
    padding: 0;
    text-align: left;
}

/* ====== MEDIA ELEMENTS NORMALIZATION ====== */
video,
audio,
canvas,
iframe,
embed,
object {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ====== CHROME/EDGE SPECIFIC FIXES ====== */
@supports (-webkit-appearance: none) {
    /* Chrome/Edge specific */
    * {
        -webkit-font-smoothing: antialiased;
    }
}

/* ====== FIREFOX SPECIFIC FIXES ====== */
@-moz-document url-prefix() {
    /* Firefox specific */
    * {
        -moz-osx-font-smoothing: grayscale;
    }

    body {
        font-smoothing: antialiased;
    }
}

/* ====== SAFARI SPECIFIC FIXES ====== */
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
    /* Safari specific */
    html {
        -webkit-font-smoothing: antialiased;
    }

    body {
        -webkit-font-smoothing: antialiased;
    }

    /* Fix Safari flexbox issues */
    .flex-container {
        display: -webkit-flex;
        display: flex;
    }

    /* Fix Safari transform issues */
    .transform-element {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* ====== OPERA SPECIFIC FIXES ====== */
@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) {
    /* Opera specific */
    * {
        -webkit-font-smoothing: antialiased;
    }
}

/* ====== BRAVE SPECIFIC FIXES ====== */
/* Brave uses Chromium, inherits Chrome fixes */

/* ====== CONSISTENT SCROLLBAR STYLING ====== */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

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

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* ====== CONSISTENT SELECTION STYLING ====== */
::selection {
    background-color: rgba(13, 110, 253, 0.3);
    color: inherit;
}

::-moz-selection {
    background-color: rgba(13, 110, 253, 0.3);
    color: inherit;
}

/* ====== CONSISTENT FOCUS STYLING ====== */
:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* ====== CONSISTENT ANIMATION PERFORMANCE ====== */
.animated,
[class*="animate"],
[class*="transition"] {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

/* ====== CONSISTENT FLEXBOX ====== */
.flex,
[class*="flex"] {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
}

/* ====== CONSISTENT GRID ====== */
.grid,
[class*="grid"] {
    display: -webkit-grid;
    display: -ms-grid;
    display: grid;
}

/* ====== CONSISTENT TRANSFORMS ====== */
.transform,
[class*="transform"] {
    -webkit-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
}

/* ====== CONSISTENT TRANSITIONS ====== */
.transition,
[class*="transition"] {
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

/* ====== PRINT STYLING ====== */
@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;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

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

/* ====== ACCESSIBILITY - CONSISTENT ACROSS BROWSERS ====== */
@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;
    }
}

/* ====== DARK MODE - CONSISTENT ACROSS BROWSERS ====== */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

/* ====== HIGH CONTRAST MODE ====== */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }
}

