/* =====================================================
   BASE STYLES - Reset i osnovni stilovi
   ===================================================== */

/* Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Root Setup */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* iOS Safari 100vh fix - use custom property */
:root {
    --vh: 1vh;
}

/* Body - 2025 Premium Gradient Background (Not Pure Black) */
body {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary, #fff);
    background: var(--bg-dark, #0c0c14);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated Gradient Background Mesh - Dark with warm tones */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 20% 20%, rgba(255, 107, 53, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 85% 15%, rgba(255, 152, 0, 0.06) 0%, transparent 45%),
        radial-gradient(ellipse 70% 60% at 10% 80%, rgba(255, 193, 7, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse 50% 50% at 90% 85%, rgba(255, 140, 0, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse 100% 80% at 50% 50%, rgba(255, 215, 0, 0.03) 0%, transparent 60%),
        linear-gradient(180deg, 
            #0c0c12 0%, 
            #0e0e14 15%,
            #101016 30%,
            #121218 50%,
            #101016 70%,
            #0e0e14 85%,
            #0c0c12 100%);
    pointer-events: none;
    z-index: -2;
}

/* Subtle Noise Texture */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.012;
    pointer-events: none;
    z-index: -1;
}

/* Focus Styles */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--primary, #ff6b35);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: rgba(255, 107, 53, 0.3);
    color: var(--text-primary, #fff);
}

::-moz-selection {
    background: rgba(255, 107, 53, 0.3);
    color: var(--text-primary, #fff);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary, #0a0a0f);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Links */
a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast, 0.15s ease);
}

a:hover {
    color: var(--primary, #ff6b35);
}

/* Images */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary, #fff);
    margin: 0 0 1rem;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin: 0 0 1rem;
    color: var(--text-secondary, rgba(255,255,255,0.7));
}

strong, b {
    font-weight: 600;
}

small {
    font-size: 0.875rem;
}

/* Lists */
ul, ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Horizontal Rule */
hr {
    border: 0;
    height: 1px;
    background: var(--glass-border, rgba(255,255,255,0.1));
    margin: 2rem 0;
}

/* Table Reset */
table {
    border-collapse: collapse;
    width: 100%;
}

/* Button Reset */
button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* Input Reset */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
    border: none;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted, rgba(255,255,255,0.5));
}

/* Fieldset Reset */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

/* Remove autofill background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary, #fff);
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-secondary, #12121a) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Remove number input arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Remove search input X */
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;
}

/* Blockquote */
blockquote {
    margin: 0;
    padding: 1.5rem;
    border-left: 4px solid var(--primary, #ff6b35);
    background: var(--glass-bg, rgba(255,255,255,0.05));
    border-radius: 0 var(--radius-md, 10px) var(--radius-md, 10px) 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* Code */
code, pre {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

code {
    padding: 0.2rem 0.4rem;
    background: var(--glass-bg);
    border-radius: var(--radius-sm, 6px);
    font-size: 0.875em;
    color: var(--primary);
}

pre {
    padding: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg, 14px);
    overflow-x: auto;
}

pre code {
    padding: 0;
    background: none;
    border-radius: 0;
}

/* Media Embeds */
iframe, embed, object, video {
    max-width: 100%;
}

/* Address */
address {
    font-style: normal;
}

/* Mark */
mark {
    background: rgba(255, 107, 53, 0.3);
    color: inherit;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

/* Abbreviation */
abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
}

/* Summary */
summary {
    cursor: pointer;
    display: list-item;
}

/* Details */
details {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

details[open] summary {
    margin-bottom: 1rem;
}

/* Dialog Reset */
dialog {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

/* App Wrapper */
#app,
.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Main Content */
main {
    flex: 1;
}

/* 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;
    }
}

/* =====================================================
   RESPONSIVE & DEVICE OPTIMIZATIONS
   ===================================================== */

/* Landscape Mode - Mobile Phones */
@media (orientation: landscape) and (max-height: 500px) {
    :root {
        --section-padding: 2rem 0;
        --header-height: 60px;
    }
    
    .section {
        padding: 2rem 0;
    }
    
    .section--lg {
        padding: 3rem 0;
    }
    
    h1 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
    h2 { font-size: clamp(1.25rem, 3vw, 2rem); }
    
    /* Hide decorative elements in landscape */
    .hide-landscape {
        display: none !important;
    }
}

/* Tablet Portrait */
@media (max-width: 992px) and (orientation: portrait) {
    :root {
        --section-padding: 3.5rem 0;
    }
    
    .section {
        padding: 3.5rem 0;
    }
}

/* Tablet Landscape */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    :root {
        --container-padding: 2rem;
    }
}

/* Small Mobile */
@media (max-width: 375px) {
    :root {
        --container-padding: 1rem;
    }
    
    body {
        font-size: 0.9375rem;
    }
}

/* Foldable/Small devices */
@media (max-width: 320px) {
    :root {
        --container-padding: 0.75rem;
    }
    
    body {
        font-size: 0.875rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.375rem; }
    h3 { font-size: 1.25rem; }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body::after {
        opacity: 0.008; /* Less noise on retina */
    }
}

/* Safe area for notched devices (iPhone X, etc.) */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(var(--container-padding, 1.5rem), env(safe-area-inset-left));
        padding-right: max(var(--container-padding, 1.5rem), env(safe-area-inset-right));
    }
    
    .footer {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
}

/* Touch devices - larger tap targets */
@media (hover: none) and (pointer: coarse) {
    button, 
    a, 
    input[type="submit"],
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Exclude small indicator dots from tap target sizing */
    .hero__slider-dot,
    .carousel-indicator,
    [class*="slider-dot"],
    [class*="-indicator"] {
        min-height: unset;
        min-width: unset;
    }
    
    /* Disable hover effects on touch */
    .product-card:hover {
        transform: none;
    }
}
