/* global.css - PROFESSIONAL GRADE v2.0 */

/* ============================================
   ACCESSIBILITY UTILITIES
   ============================================ */

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

/* Skip link for keyboard navigation */
.skip-link:focus {
    position: absolute !important;
    left: 0 !important;
    top: 0;
    z-index: 10000;
    padding: 1em 1.5em;
    background: var(--primary-green, #69B254);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 8px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* CSS Custom Properties for theming */
:root {
    --primary-green: #69B254;
    --primary-green-dark: #4d9342;
    --primary-green-light: #7bc463;
    --dark-bg: #0E2A2E;
    --text-primary: #232946;
    --text-secondary: #36454F;
    --text-light: #777;
    --bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --shadow-sm: 0 2px 8px rgba(80,80,80,0.07);
    --shadow-md: 0 4px 14px rgba(44,62,80,0.09);
    --shadow-lg: 0 8px 26px rgba(44,62,80,0.16);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 18px;
    --navbar-height-desktop: 72px;
    --navbar-height-tablet: 64px;
    --navbar-height-mobile: 64px;
}

/* ============================================
   UNIVERSAL BOX-SIZING & OVERFLOW PROTECTION
   ============================================ */

/* Apply box-sizing to all elements for consistent layout */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    scroll-behavior: smooth;
    background: #1a1a1a;
    /* REMOVED: overscroll-behavior-y: none; - causes scroll issues */
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', Arial, sans-serif;
    background: var(--bg-gradient);
    background-attachment: scroll; /* CHANGED from fixed - fixes mobile scroll */
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto; /* ADDED: Explicitly allow vertical scroll */
    max-width: 100vw;
    /* REMOVED: overscroll-behavior-y: none; - causes scroll issues */
    -webkit-overflow-scrolling: touch; /* ADDED: iOS smooth scrolling */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* GLAVNI KONTEJNER - OPTIMIZED */
.main-container {
    flex: 1 0 auto;
    width: 100%;
    padding-top: var(--navbar-height-desktop);
    min-height: calc(100vh - var(--navbar-height-desktop));
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Osnovni heading i tekst */
h1, h2, h3, h4, h5, h6, p, ul, li, a {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: inherit;
}

/* Linkovi */
a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}
a:hover {
    color: var(--primary-green);
}

/* Dugmad */
button, .btn, .learn-more-button {
    font-family: inherit;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.learn-more-button {
    background-color: #69B254;
    color: #fff;
    padding: 10px 24px;
    font-weight: 600;
    margin-top: 18px;
    transition: background .2s;
}
.learn-more-button:hover {
    background-color: #558a43;
    color: #fff;
}

/* ============================================
   NOTE: All navbar styles have been moved to navbar.css
   for modern 2026 design with glass morphism effects.
   DO NOT add navbar styles here to avoid conflicts!
   ============================================ */

/* FOOTER - MODERN 2026 PROFESSIONAL DESIGN */
footer {
    /* Modern gradient background with glass morphism */
    background: linear-gradient(
        135deg,
        rgba(14, 42, 46, 0.85) 0%,
        rgba(20, 30, 35, 0.9) 100%
    );
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    color: #fff;
    width: 100%;
    /* Modern glow border */
    border-top: 1px solid rgba(105, 178, 84, 0.2);
    box-shadow:
        0 -2px 8px rgba(0, 0, 0, 0.1),
        0 -4px 16px rgba(0, 0, 0, 0.05);
    font-family: 'Poppins', Arial, sans-serif;
    margin-top: auto;
    flex-shrink: 0;
    position: relative;
}

.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    /* Modern gradient text */
    background: linear-gradient(135deg, #69B254 0%, #7bc463 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.footer-brand:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 12px rgba(105, 178, 84, 0.4));
}

.footer-brand img {
    height: 36px;
    width: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 4px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(105, 178, 84, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-brand:hover img {
    transform: rotate(-5deg) scale(1.1);
    box-shadow:
        0 4px 12px rgba(105, 178, 84, 0.3),
        0 0 0 2px rgba(105, 178, 84, 0.3);
}

.footer-links {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.footer-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Modern glass effect */
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    border-radius: 12px;
    width: 52px;
    height: 52px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(105, 178, 84, 0.2);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

/* Hover glow effect */
.footer-links a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at center,
        rgba(105, 178, 84, 0.2) 0%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.footer-links a:hover::before {
    opacity: 1;
}

.footer-links a:hover {
    background: linear-gradient(
        135deg,
        rgba(105, 178, 84, 0.15) 0%,
        rgba(105, 178, 84, 0.08) 100%
    );
    border-color: rgba(105, 178, 84, 0.5);
    transform: translateY(-4px);
    box-shadow:
        0 6px 20px rgba(105, 178, 84, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.footer-links img {
    width: 26px;
    height: 26px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: brightness(0.95);
}

.footer-links a:hover img {
    transform: scale(1.15);
    filter: brightness(1.1);
}

.footer-legal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0 15px;
    flex-wrap: wrap;
}

.footer-legal a {
    color: #69B254;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.footer-legal a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #69B254, #7fc961);
    transition: width 0.3s ease;
}

.footer-legal a:hover {
    color: #7fc961;
}

.footer-legal a:hover::after {
    width: 100%;
}

.footer-legal .separator {
    color: rgba(105, 178, 84, 0.5);
    font-size: 0.8rem;
}

.footer-legal span {
    color: rgba(255, 255, 255, 0.4);
}

.footer-bottom {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    padding-top: 8px;
    text-align: center;
}

/* Ad Container */
.ad-container {
    text-align: center;
    margin: 30px auto;
    max-width: 728px;
    min-height: 90px;
}

@media (max-width: 480px) {
    .ad-container {
        margin: 20px auto;
        min-height: 50px;
    }

    /* Educational cards responsive padding */
    .bmi-edu-card,
    .calorie-education-section > div {
        padding: 24px 20px !important;
    }

    .calorie-education-section {
        padding: 0 12px !important;
    }

    .bmi-education-section {
        padding: 0 12px !important;
    }
}

/* Grid layout - univerzalna podesavanja */
.container, .content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 18px;
    box-sizing: border-box;
}

/* RESPONSIVE IMAGES AND MEDIA */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.responsive-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
}

.aspect-ratio-16-9 {
    aspect-ratio: 16/9;
}

.aspect-ratio-4-3 {
    aspect-ratio: 4/3;
}

.aspect-ratio-1-1 {
    aspect-ratio: 1/1;
}

/* Image containers */
.img-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.img-container:hover img {
    transform: scale(1.05);
}

/* Media queries for images */
@media (max-width: 768px) {
    .img-container {
        border-radius: 8px;
    }
    
    .img-container:hover img {
        transform: none;
    }
}

/* Sekcije */
section {
    padding: 56px 0;
    text-align: center;
    background: transparent;
}

/* RESPONSIVE - OPTIMIZED */
/* Navbar styles removed - see navbar.css */
@media (max-width: 1024px) {
    .main-container {
        padding-top: var(--navbar-height-tablet);
        min-height: calc(100vh - var(--navbar-height-tablet));
    }
}

/* Navbar styles removed - see navbar.css */
@media (max-width: 900px) {
    .main-container {
        padding-top: var(--navbar-height-tablet);
        min-height: calc(100vh - var(--navbar-height-tablet));
    }
}

@keyframes slideDown {
    from { 
        opacity: 0; 
        transform: translateY(-20px) scale(0.95);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-16px);}
    to { opacity: 1; transform: none;}
}

/* Navbar styles removed - see navbar.css */
@media (max-width: 768px) {
    :root {
        --navbar-height-mobile: 64px;
    }

    .main-container {
        padding-top: var(--navbar-height-mobile);
        min-height: calc(100vh - var(--navbar-height-mobile));
    }
}

/* Navbar styles removed - see navbar.css */
@media (max-width: 600px) {
    :root {
        --navbar-height-mobile: 64px;
    }

    .main-container {
        padding-top: var(--navbar-height-mobile);
        min-height: calc(100vh - var(--navbar-height-mobile));
    }

    /* Footer optimizacije */
    .footer-container {
        padding: 24px 12px 12px 12px;
        gap: 14px;
    }

    .footer-brand {
        font-size: 1.08rem;
        margin-bottom: 6px;
    }

    .footer-brand img {
        height: 28px;
        width: 28px;
    }

    .footer-links {
        gap: 16px;
    }

    .footer-links a {
        width: 48px;
        height: 48px;
    }

    .footer-links img {
        width: 24px;
        height: 24px;
    }

    .footer-legal {
        gap: 8px;
        margin: 15px 0 10px;
        font-size: 0.85rem;
    }

    .footer-legal a {
        font-size: 0.85rem;
    }

    .footer-bottom {
        font-size: 0.98rem;
        padding-top: 6px;
    }
}
  
/* Navbar styles removed - see navbar.css */
@media (max-width: 480px) {
    :root {
        --navbar-height-mobile: 60px;
    }

    .main-container {
        padding-top: var(--navbar-height-mobile);
        min-height: calc(100vh - var(--navbar-height-mobile));
    }

    /* Globalne sekcije */
    section {
        padding: 32px 0;
    }

    .container, .content-container {
        padding: 0 14px;
    }

    /* Responsive images for mobile */
    .img-container {
        border-radius: var(--border-radius-sm);
    }

    .responsive-img {
        border-radius: var(--border-radius-sm);
    }

    /* Footer za male ekrane */
    .footer-container {
        padding: 20px 10px 10px 10px;
        gap: 12px;
    }

    .footer-brand {
        font-size: 1.05rem;
    }

    .footer-links a {
        width: 48px;
        height: 48px;
    }

    .footer-links img {
        width: 22px;
        height: 22px;
    }

    .footer-bottom {
        font-size: 0.95rem;
    }
}

/* Navbar styles removed - see navbar.css */
@media (max-width: 360px) {
    :root {
        --navbar-height-mobile: 58px;
    }

    .main-container {
        padding-top: var(--navbar-height-mobile);
        min-height: calc(100vh - var(--navbar-height-mobile));
    }

    .footer-brand {
        font-size: 1rem;
    }

    .footer-links a {
        width: 44px;
        height: 44px;
    }

    .footer-links img {
        width: 20px;
        height: 20px;
    }

    .footer-bottom {
        font-size: 0.92rem;
    }
}

/* ============================================
   OVERFLOW PREVENTION & LAYOUT SAFETY
   ============================================ */

/* Ensure all major containers respect viewport width */
.main-container,
.content-container,
.container,
section {
    max-width: 100%;
    overflow-x: hidden;
}

/* Prevent images and media from breaking layout */
img,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Prevent pre and code blocks from causing horizontal scroll */
pre,
code {
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Ensure tables are responsive */
table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* Prevent long words and URLs from breaking layout */
p, li, div, span, a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* ============================================
   LANDSCAPE ORIENTATION OPTIMIZATIONS
   ============================================ */

/* Mobile Landscape Mode - reduce vertical spacing */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
    .main-container {
        padding-top: 60px;
        min-height: auto;
    }

    section {
        padding: 32px 0;
    }

    footer {
        position: relative;
    }

    .footer-container {
        padding: 24px 20px 16px;
    }
}

/* Tablet Landscape - optimize spacing */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .main-container {
        padding-top: 64px;
    }

    section {
        padding: 40px 0;
    }
}

/* Small Phone Landscape - extreme compact mode */
@media (max-width: 740px) and (max-height: 420px) and (orientation: landscape) {
    .main-container {
        padding-top: 56px;
        min-height: auto;
    }

    section {
        padding: 24px 0;
    }

    h1 {
        font-size: 1.6rem !important;
    }

    h2 {
        font-size: 1.4rem !important;
    }

    .footer-container {
        padding: 20px 16px 12px;
    }

    .footer-brand {
        font-size: 1rem;
    }

    .footer-links a {
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   SCROLL FIX - Allow touch scrolling on all devices
   ============================================ */
html, body {
    touch-action: pan-y pinch-zoom;
}

* {
    -webkit-tap-highlight-color: transparent;
}