/*
Theme Name:  Apkurs
Description: Šablona webu Apkurs
Version:     1.0.1
*/

/* CSS Variables */
:root {
    --primary-color: #2e3749;
    --secondary-color: #3799fb;
    --text-color: #fff;
    --link-shadow-color: #2366ad;
    --thin-border-color: #50bef2;
    --fat-border-color: #8b95b0;
    --content-text-color: #E2E8F0;
    --body-bg-color: #858a9c;
    
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    --desktop-width: 960px;
    --mobile-menu-width: 280px;
    --mobile-menu-small-width: 250px;
    
    --border-radius: 6px;
    --small-border-radius: 3px;
    --box-shadow: 2px 0 15px #555;
}

/* Base styles */
html {
    overflow-y: scroll;
}

body {
    background: var(--body-bg-color) url(assets/main_back.png) repeat-x;
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    margin: 20px auto;
    padding: 0;
    width: var(--desktop-width);
}

a {
    color: var(--text-color);
}

hr {
    border: 0 !important;
    height: 2px;
    background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
    margin: 3.5rem 0 4.5rem 0;
}

/* Header & Logo */
#header {
    width: var(--desktop-width);
    height: 255px;
    background: url(assets/header_back2.png) no-repeat center top;
    position: relative;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.logo-box {
    align-items: center;
    display: flex;
    position: absolute;
    top: 58px;
    left: 10px;
    background: var(--secondary-color);
    border: 1px solid var(--thin-border-color);
    border-radius: var(--small-border-radius);
    color: var(--text-color);
    gap: 48px;
    padding: 22px 0 22px 32px;
    text-shadow: 1px 1px #377fff;
    width: 318px;
}

.logo-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.logo-subtitle {
    font-size: 1.05rem;
    font-weight: 350;
    margin: 8px 0 0 0;
    line-height: 1.4;
    opacity: 0.95;
}

.logo-link {
    display: inline-block;
    text-decoration: none;
    color: inherit;
}

.logo-link .logo-box {
    cursor: pointer;
}

/* Navigation Menu */
#menu {
    background: var(--primary-color);
    border: 10px solid var(--fat-border-color);
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: var(--box-shadow);
    padding: 10px 10px 0 10px;
}

#menu > div > ul,
.main-menu {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    list-style: none;
    background: var(--primary-color);
    border-radius: var(--small-border-radius) var(--small-border-radius) 0 0;
}

.menu-item,
.page_item {
    display: block;
    flex: 1;
    list-style-type: none;
    position: relative;
}

.menu-item:first-child,
.page_item:first-child {
    border-radius: var(--small-border-radius) 0 0 0;
}

.menu-item:last-child,
.page_item:last-child {
    border-right: none;
    border-radius: 0 var(--small-border-radius) 0 0;
}

.menu-item > a,
.page_item > a {
    display: block;
    padding: 12px;
    color: var(--text-color);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    text-align: center;
    transition: all 0.3s;
    white-space: nowrap;
    border: 1px solid transparent;
    border-bottom: none;
}

.menu-item > a:hover,
.page_item > a:hover {
    text-decoration: underline;
}

.current_page_item > a,
.current-menu-item > a,
.current-menu-ancestor > a,
.current-menu-parent > a {
    color: var(--text-color);
    background-color: var(--secondary-color);
    border-color: var(--thin-border-color);
    border-radius: var(--small-border-radius) var(--small-border-radius) 0 0;
    position: relative;
    z-index: 10;
    text-shadow: 1px 1px #377fff;
    margin-bottom: 0;
}

body.home .main-menu .current_page_item > a {
    text-decoration: none;
}

.menu-item-has-children .sub-menu,
.page_item_has_children .children {
    display: none !important;
}

/* Submenu Bar */
#submenu-bar {
    display: flex;
    align-items: center;
    min-height: 38px;
    background: var(--secondary-color);
    width: 920px;
    margin: 0 0 20px 0;
    border: 10px solid var(--fat-border-color);
    border-top: none;
    border-right: 20px solid var(--fat-border-color);
    border-bottom: 10px solid var(--fat-border-color);
    border-left: 20px solid var(--fat-border-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: inset 0 -1px 0 0 var(--thin-border-color);
}

#submenu-bar ul {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0;
    margin: 0;
    list-style: none;
    min-height: 38px;
}

#submenu-bar li {
    margin-right: 8px;
}

#submenu-bar a {
    padding: 7px 18px;
    color: var(--text-color);
    background: transparent;
    text-decoration: none;
}

#submenu-bar a:hover {
    text-decoration: underline;
}

#submenu-bar .current_page_item > a,
#submenu-bar .current-menu-item > a,
#submenu-bar .current-menu-ancestor > a,
#submenu-bar .current-menu-parent > a {
    border: none;
    text-decoration: underline;
}

/* Content Area */
#content {
    background: var(--primary-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    box-sizing: border-box;
    border: 10px solid var(--fat-border-color);
    color: var(--content-text-color);
    margin: 0 0 10px 0;
    padding: 4rem 2.5rem 2.5rem;
    width: var(--desktop-width);
}

h1, h2 {
    color: var(--content-text-color);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 5rem 1.5rem 0;
    padding: 0 0 0.75rem 0;
    line-height: 1.3;
}

#content ul {
    list-style: none;
    padding-left: 1.5em;
}

#content li {
    margin-bottom: 16px;
    position: relative;
}

#content li::before {
    content: "";
    position: absolute;
    left: -1.2em;
    top: 0.5em;
    width: 8px;
    height: 8px;
    background: var(--secondary-color);
    display: block;
    border-radius: 2px;
}

/* Text wrapping fixes */
#content a {
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

#content p {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* WordPress block styles - Fix for title/web sections */
.wp-block-group.is-layout-flex {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: nowrap;
    margin-bottom: 8px;
}

.wp-block-group.is-layout-flex p {
    margin: 0;
    flex: none;
    word-break: break-word;
    line-height: 1.4;
}

.wp-block-group.is-layout-flex p:first-child {
    min-width: 50px;
    max-width: 50px;
    flex-shrink: 0;
    font-weight: bold;
}

.wp-block-group.is-layout-flex p:last-child {
    flex: 1;
    min-width: 0;
    word-break: break-all;
    overflow-wrap: anywhere;
}

#content .wp-block-group a[href*="http"] {
    word-break: break-all;
    overflow-wrap: anywhere;
    hyphens: none;
    max-width: 100%;
    display: inline-block;
}

#content * {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Footer */
#footer {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 15px;
    width: var(--desktop-width);
}

/* Mobile Menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--secondary-color);
    border-radius: 4px;
    border: 1px solid var(--thin-border-color);
}

.hamburger span {
    width: 22px;
    height: 2.5px;
    background: var(--text-color);
    margin: 2.5px 0;
    transition: 0.3s;
    border-radius: 2px;
    transform-origin: center;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg);
    position: relative;
    top: 8px;
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg);
    position: relative;
    top: -8px;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: calc(-1 * var(--mobile-menu-width));
    width: var(--mobile-menu-width);
    height: 100vh;
    background: var(--primary-color);
    z-index: 999;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding-top: 60px;
}

.mobile-menu.active {
    left: 0;
}

.admin-bar .mobile-menu {
    top: 32px;
    height: calc(100vh - 32px);
}

.mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu a {
    display: block;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1rem;
    transition: background 0.3s;
    text-align: left;
}

.mobile-menu a:hover,
.mobile-menu .current_page_item > a,
.mobile-menu .current-menu-item > a {
    background: var(--secondary-color);
}

.mobile-menu .sub-menu,
.mobile-menu .children {
    display: block !important;
    background: rgba(0, 0, 0, 0.2);
    margin: 0;
    padding: 0;
}

.mobile-menu .sub-menu li,
.mobile-menu .children li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-menu .sub-menu a,
.mobile-menu .children a {
    padding: 10px 20px;
    padding-left: 30px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.mobile-menu .sub-menu a:hover,
.mobile-menu .children a:hover {
    background: rgba(55, 153, 251, 0.3);
}

.mobile-menu .sub-menu .sub-menu a {
    padding-left: 40px;
    font-size: 1rem;
}

.mobile-menu .main-menu {
    display: block !important;
    flex-direction: column !important;
}

.mobile-menu .main-menu > li {
    flex: none !important;
    width: 100% !important;
}

.mobile-menu .main-menu > li > a {
    text-align: left !important;
    padding: 12px 20px !important;
    font-size: 1.1rem !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        width: 100%;
        margin: 0;
        font-size: 14px;
        padding: 0;
        box-sizing: border-box;
        background: var(--primary-color);
    }

    :root {
        --fat-border-color: #2e3749;
    }

    .admin-bar body {
        padding-top: 46px;
    }

    .admin-bar .hamburger {
        top: 58px;
    }

    .admin-bar .mobile-menu {
        top: 46px;
        height: calc(100vh - 46px);
        padding-top: 20px;
    }

    .hamburger {
        display: flex !important;
        top: 12px;
        right: 12px;
    }

    .mobile-menu {
        display: block !important;
    }

    #menu,
    #submenu-bar {
        display: none !important;
    }

    #header {
        width: 100%;
        height: auto;
        min-height: auto;
        margin-bottom: 15px;
        background: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        box-sizing: border-box;
    }

    .logo-link {
        display: block;
        width: 100%;
    }

    .logo-box {
        position: static;
        width: 100%;
        margin: 0;
        padding: 25px 20px;
        flex-direction: row;
        gap: 30px;
        align-items: center;
        text-align: left;
        background: var(--secondary-color);
        border-radius: var(--border-radius);
        border: 1px solid var(--thin-border-color);
        box-sizing: border-box;
        left: auto;
        top: auto;
        justify-content: flex-start;
    }

    .logo-title {
        font-size: 1.8rem;
        margin: 0;
        flex-shrink: 0;
    }

    .logo-subtitle {
        font-size: 0.9rem;
        margin: 0;
        line-height: 1.3;
        flex: 1;
    }

    #content {
        width: 100%;
        margin: 0 0 10px 0;
        border: none;
        border-radius: 0;
        padding: 20px;
        box-shadow: none;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* Mobile text fixes */
    #content a {
        word-break: break-all;
        overflow-wrap: anywhere;
        hyphens: auto;
    }

    #content p {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* Mobile title/web fixes */
    .wp-block-group.is-layout-flex {
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .wp-block-group.is-layout-flex p {
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1.4 !important;
    }

    .wp-block-group.is-layout-flex p:first-child {
        min-width: 45px !important;
        max-width: 45px !important;
        flex: none !important;
        font-weight: bold;
    }

    .wp-block-group.is-layout-flex p:last-child {
        flex: 1 !important;
        min-width: 0 !important;
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
    }

    h1, h2 {
        font-size: 1.6rem;
        margin-right: 0;
        margin-bottom: 1.2rem;
    }

    #content ul {
        padding-left: 1.2em;
    }

    #content li {
        margin-bottom: 12px;
    }

    #footer {
        width: 100%;
        margin: 0;
        font-size: 0.8rem;
        text-align: center;
        padding: 20px;
        background: var(--primary-color);
        color: var(--text-color);
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    body {
        background: var(--primary-color);
    }

    :root {
        --fat-border-color: #2e3749;
    }

    .logo-box {
        padding: 20px 15px;
        gap: 20px;
    }

    .logo-title {
        font-size: 1.5rem;
    }

    .logo-subtitle {
        font-size: 0.8rem;
    }

    #content {
        padding: 15px;
        overflow-x: hidden;
    }

    #content a {
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
        line-height: 1.4;
    }

    .wp-block-group.is-layout-flex {
        gap: 6px !important;
        margin-bottom: 6px !important;
    }

    .wp-block-group.is-layout-flex p:first-child {
        min-width: 40px !important;
        max-width: 40px !important;
        font-size: 0.85rem !important;
    }

    .wp-block-group.is-layout-flex p:last-child {
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
    }

    h1, h2 {
        font-size: 1.4rem;
    }

    .hamburger {
        top: 8px;
        right: 8px;
        padding: 6px;
    }

    .hamburger span {
        width: 20px;
        height: 2px;
        margin: 2px 0;
    }

    .hamburger.active span:nth-child(1) {
        top: 6px;
    }

    .hamburger.active span:nth-child(3) {
        top: -6px;
    }

    .admin-bar .hamburger {
        top: 54px;
    }

    .mobile-menu {
        width: var(--mobile-menu-small-width);
        left: calc(-1 * var(--mobile-menu-small-width));
        padding-top: 50px;
    }

    .mobile-menu a {
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .mobile-menu .sub-menu a,
    .mobile-menu .children a {
        padding: 8px 15px;
        padding-left: 25px;
        font-size: 0.8rem;
    }

    .mobile-menu .sub-menu .sub-menu a {
        padding-left: 35px;
    }
}

@media (min-width: 769px) {
    .hamburger,
    .mobile-menu,
    .mobile-menu-overlay {
        display: none !important;
    }
}