/* =================================================================
   CSS RESET & NORMALIZE - VELTECHLAB
   ================================================================= */

/* =================================================================
   MODERN CSS RESET
   ================================================================= */

/* Box sizing rules */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Remove default margin and padding */
* {
    margin: 0;
    padding: 0;
}

/* Set core body defaults */
html {
    line-height: 1.15;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    min-height: 100vh;
    line-height: 1.6;
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;
}

/* Remove list styles on ul, ol elements with a list role */
ul[role="list"],
ol[role="list"] {
    list-style: none;
}

/* Set core root defaults */
html:focus-within {
    scroll-behavior: smooth;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
    text-decoration-skip-ink: auto;
}

/* Make images easier to work with */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
/* NOTE: Дублиращият се код е премахнат - виж по-долу в секцията REDUCED MOTION */

/* =================================================================
   ELEMENT RESETS
   ================================================================= */

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

p {
    margin: 0;
}

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

li {
    margin: 0;
    padding: 0;
}

/* Links */
a {
    background-color: transparent;
    text-decoration: none;
    color: inherit;
}

a:active,
a:hover {
    outline: 0;
}

/* Forms */
button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
    border: none;
    outline: none;
    background: none;
}

button,
input {
    overflow: visible;
}

button,
select {
    text-transform: none;
}

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

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
    outline: 1px dotted ButtonText;
}

fieldset {
    padding: 0.35em 0.75em 0.625em;
    margin: 0;
    border: none;
}

legend {
    box-sizing: border-box;
    color: inherit;
    display: table;
    max-width: 100%;
    padding: 0;
    white-space: normal;
}

progress {
    vertical-align: baseline;
}

textarea {
    overflow: auto;
    resize: vertical;
}

[type="checkbox"],
[type="radio"] {
    box-sizing: border-box;
    padding: 0;
}

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
    height: auto;
}

[type="search"] {
    -webkit-appearance: textfield;
    outline-offset: -2px;
}

[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
}

::-webkit-file-upload-button {
    -webkit-appearance: button;
    font: inherit;
}

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

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

/* Embedded content */
embed,
iframe,
object {
    max-width: 100%;
}

/* Code */
code,
kbd,
pre,
samp {
    font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
    font-size: 1em;
}

/* Blockquotes */
blockquote,
q {
    quotes: none;
    margin: 0;
    padding: 0;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
    content: "";
    content: none;
}

/* Horizontal rules */
hr {
    box-sizing: content-box;
    height: 0;
    overflow: visible;
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1rem 0;
}

/* =================================================================
   ACCESSIBILITY IMPROVEMENTS
   ================================================================= */

/* Focus styles */
:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

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

:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Skip links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

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

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

    a[href]:after {
        content: " (" attr(href) ")";
    }

    abbr[title]:after {
        content: " (" attr(title) ")";
    }

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

    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group;
    }

    tr,
    img {
        page-break-inside: avoid;
    }

    img {
        max-width: 100% !important;
    }

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

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

/* =================================================================
   HIGH CONTRAST MODE
   ================================================================= */

@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }

    img {
        filter: contrast(1.2);
    }

    button,
    input,
    select,
    textarea {
        border: 2px solid currentColor !important;
    }
}

/* =================================================================
   DARK MODE SUPPORT
   ================================================================= */

@media (prefers-color-scheme: dark) {
    html {
        color-scheme: dark;
    }

    body {
        background-color: #0f172a;
        color: #f8fafc;
    }

    hr {
        border-color: #475569;
    }
}

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

    html {
        scroll-behavior: auto;
    }
}

/* =================================================================
   MOBILE OPTIMIZATIONS
   ================================================================= */

/* Prevent horizontal scroll on mobile */
html,
body {
    overflow-x: hidden;
    width: 100%;
}

/* Ensure images and media don't overflow */
img,
video,
iframe,
embed,
object {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Изображения: без принудителна ширина 100% (лога и икони остават коректни); без хоризонтален overflow */
img {
    max-width: 100%;
    height: auto;
}

/* Осигурява адаптивност на iframe и embed */
iframe,
embed {
    width: 100%;
    max-width: 100%;
}

/*
 * Минимални зони за докосване (WCAG / мобилни насоки).
 * Не се прилага към всички <a> — вътрешните връзки в текст остават нормални.
 */
button,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
    min-height: 44px;
}

input[type="checkbox"],
input[type="radio"] {
    min-height: auto;
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

a.btn,
a[class*="btn-"],
a.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    box-sizing: border-box;
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
    /* Fix table overflow */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix pre and code blocks */
    pre,
    code {
        overflow-x: auto;
        word-wrap: break-word;
        white-space: pre-wrap;
    }
    
    /* Осигурява адаптивност на форми */
    form {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    input,
    textarea,
    select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Disable text selection on interactive elements */
button,
input,
select,
textarea {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Enable text selection on content */
p,
h1,
h2,
h3,
h4,
h5,
h6,
li,
td,
th {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* =================================================================
   UTILITY CLASSES
   ================================================================= */

/* Clearfix */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Visually hidden but accessible */
.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;
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Prevent text wrapping */
.nowrap {
    white-space: nowrap;
}

/* Allow text wrapping */
.wrap {
    white-space: normal;
}

/* Break long words */
.break-words {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Prevent text overflow */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =================================================================
   BROWSER SPECIFIC FIXES
   ================================================================= */

/* Firefox specific */
@-moz-document url-prefix() {
    body {
        font-weight: 400;
    }
}

/* Safari specific */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select,
    textarea,
    input {
        font-size: 16px;
    }
}

/* IE specific */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    .clearfix::after {
        content: "";
        display: block;
        clear: both;
    }
}
