/***** Optimalizovaný custom.css *****/

/* Globální opravy */
@media screen and (min-width:480px) {
    body { font-size: 16px !important; }
}

.nadpis1, .nadpis1 a { color:#800000; text-decoration: none; line-height: 35px; }
.nadpis2, .nadpis2 a { color:#daa520; text-decoration: none; line-height: 35px; }
.custompartneri img { border: 0; }
.container { padding: 0px 15px; }

/* FIXNÍ LIŠTA (Affix) - Přesná rekonstrukce původního stavu */
@media screen and (min-width:1024px) {
    .header { 
        position: fixed !important;
        width: 100%;
        z-index: 999;
        /* Návrat k původní průhlednosti přes obrázek */
        background: url(../images/black.png) !important; 
        transition: all 0.2s ease-in-out;
        height: 80px !important; /* Původní výška */
        padding: 10px 0px !important;
        border-bottom: none !important;
    }

    /* Stav při rolování - černá a mírně vyšší (dle vašeho popisu +10px k původnímu paddingu) */
    .header.affix { 
        background: #111111 !important; 
        padding: 0px !important; 
        height: 70px !important; /* Fixní výška při scrollu */
        box-shadow: 0px 2px 10px rgba(0,0,0,0.5);
    }

    /* Logo - posunutí nahoru a zmenšení */
    .logo {
        padding: 5px !important;
        transition: all 0.2s ease;
    }

    .header.affix .logo {
        margin-top: -5px !important; /* Posun loga nahoru v zúžené liště */
    }

    .header.affix h1 {
        transform: scale(0.85); /* Mírné zmenšení, aby nepřesahovalo */
        transform-origin: left center;
    }

    /* MENU - Posunutí nahoru a úprava podtržení */
    .navigation {
        margin-top: -5px !important; /* Posun celého bloku menu nahoru */
    }

    .header.affix .navigation {
        margin-top: -8px !important; /* Větší posun při scrollu */
    }
        
    /* Celkový posun menu dolů pro oba stavy */
    @media screen and (min-width:1024px) { 
    .navigation {
        /* Původně tam bylo -5px nebo 0px, posuneme na kladnou hodnotu */
        margin-top: 5px !important; /* původně -5px */
        transition: margin-top 0.3s ease;
    }

    /* Pokud by se při scrollu mělo menu hýbat jinak, doladíme to zde */
    .header.affix .navigation {
        margin-top: 2px !important; /* Mírná korekce pro nižší lištu (70px), původně -8px */
    }
    }

    /* Zarovnání všech položek menu do stejné výšky */
    .navbar .menu li {
        border-bottom: 5px solid transparent; /* Přidá neviditelný rám i neaktivním, aby se srovnala výška */
        transition: border-color 0.2s ease;
    }

    /* Podtržení aktivního menu - posun nahoru o 10px a blíže k textu */
    .navbar .menu li.active { 
        border-bottom: 5px solid #000000 !important; 
        height: 50px !important; /* Zmenšení výšky pro přiblížení čáry k textu */
        /*margin-top: 5px !important;*/
    }

    .header-inner { width: 970px; padding: 0px 10px; margin: 0 auto; }
}

/* Dynamické šířky bannerů dle rozlišení (ponecháno dle originálu) */
@media screen and (max-width:360px){ .banneritem img { max-width: 326px;} }
@media screen and (min-width:360px){ .banneritem img { max-width: 326px;} .banner { margin-left: 10px;} }
@media screen and (min-width:420px){ .banneritem img { max-width: 370px;} .banner { margin-left: 15px;} }
@media screen and (min-width:480px){ .banneritem img { max-width: 445px;} }
@media screen and (min-width:576px){ .banneritem img { max-width: 540px;} }
@media screen and (min-width:640px){ .banneritem img { max-width: 605px;} }
@media screen and (min-width:768px){ .banneritem img { max-width: 738px;} }
@media screen and (min-width:880px){ .banneritem img { max-width: 845px;} }
@media screen and (min-width:992px){ .banneritem img { max-width: 962px;} }
@media screen and (min-width:1024px){ .banneritem img { max-width: 990px;} .banner { margin-left: 19px;} .header-inner, .container { width: 970px; padding: 0 10px; margin: 0 auto; } }
@media screen and (min-width:1080px){ .banneritem img { max-width: 980px;} .banner { margin-left: 45px;} }
@media screen and (min-width:1180px){ .banner { margin-left: 95px;} }
@media screen and (min-width:1280px){ .banneritem img { max-width: 1225px;} .banner { margin-left: 50px; } .header-inner, .container { width: 1160px; } }
@media screen and (min-width:1360px){ .banneritem img { max-width: 1240px;} .banner { margin-left: 80px; } }
@media screen and (min-width:1440px){ .banner { margin-left: 135px; } }
@media screen and (min-width:1600px){ .banner { margin-left: 210px; } } 
@media screen and (min-width:1800px){ .banner { margin-left: 305px; } }
@media screen and (min-width:1920px){ .banner { margin-left: 360px; } }
@media screen and (min-width:2048px){ .banner { margin-left: 425px; } }

/* Navidace na stránce Předchozí a Další */
.previous { float: left; margin: 0px 0px 20px 0px; }
.next { float: right; margin: 0px 0px 20px 0px; }
.previous a, .next a { color: #000000; text-decoration: none; }
.visually-hidden { display: none; }

/* Struktura a Layout */
.banner-outer, .top { float: left; width: 100%; padding: 15px 0px; clear: both; border-bottom: 1px solid #dedede; }
.maintop, .main, .user, .bottom { clear: both; }
.mainbottom { float: left; width: 100%; padding: 20px 0px 0px 0px; clear: both; background: #f0f0f0; }

/* Logo */
.logo a { font-family: Algerian, sans-serif; color: #FFFFFF; text-decoration: none; font-size: 24px; }
.logo { max-width: 280px; margin: 0 auto; padding: 10px 15px; }

@media screen and (min-width:480px){
    .logo { float: left; max-width: none; padding: 10px 0px 10px 15px; }
    .logo img { width: auto; height: 80px; }
}

/* MENU - Oprava pro J4 */
.navigation ul.nav.menu {
    display: flex !important;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navigation ul.nav.menu > li {
    position: relative;
}

.navigation ul.nav.menu > li > a {
    display: block;
    padding: 10px 15px;
    color: #fff;
    text-decoration: none;
}

/* Podmenu */
.navigation ul.nav-child, 
.navigation ul.mod-menu__sub {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #000;
    list-style: none;
    padding: 10px;
    min-width: 200px;
    z-index: 1000;
}

.navigation li:hover > ul.nav-child,
.navigation li:hover > ul.mod-menu__sub {
    display: block !important;
}

/* OPRAVA: Sloupce článků pro Hlavní stranu i Sekce (Kovovýroba, Brány) */
.blog-featured .blog-items, 
.blog-items.automaticke-brany, 
.blog-items.kovovyroba {
    display: flex !important;
    flex-flow: row wrap !important;
    margin: 0 -15px !important;
    clear: both;
}

/* Cílíme na položky v těchto kontejnerech */
.blog-featured .blog-item,
.automaticke-brany .blog-item,
.kovovyroba .blog-item {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding: 0 15px !important;
    box-sizing: border-box !important;
    float: left !important; /* Důležité pro starší prohlížeče */
}

/* Oprava pro mobilní zobrazení */
@media (max-width: 768px) {
    .blog-featured .blog-item,
    .automaticke-brany .blog-item,
    .kovovyroba .blog-item {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}


/* OCHRANA SIDEBARŮ: Vynucení původních šířek z template.css */
@media screen and (min-width:1024px) {
    .main-right { width: 700px !important; float: left !important; }
    .right-right { width: 250px !important; float: right !important; }
}

@media screen and (min-width:1280px) {
    .main-right { width: 840px !important; }
    .right-right { width: 300px !important; }
}

/***** Konec optimalizace *****/
