/* ==========================================================================
   MODULE 1812: CORE THEME STYLES (REFACTORED 2026)
   Role: Base Layout, Typography, Header, Footer
   ========================================================================== */

/* --- 1. GLOBAL SETTINGS & TYPOGRAPHY --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ACCESSIBILITY: Убираем обводку мыши, но оставляем для клавиатуры (Tab) */
*:focus { outline: none; }
*:focus-visible { outline: 2px solid #AB1E88; outline-offset: 2px; }

body {
    background-color: #F9FAFB;
    color: #374151;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

a { text-decoration: none; transition: all 0.3s ease; color: #337ab7; }
a:hover { color: #EC4899; text-decoration: none; }

img { max-width: 100%; height: auto; border-radius: 8px; }

h1, h2, h3, h4, h5 {
    font-family: 'Comfortaa', sans-serif;
    color: #111827;
    margin-bottom: 0.8em;
    line-height: 1.3;
}

/* --- 2. LAYOUT STRUCTURE --- */
#layout {
    background: #fff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    margin: 0 auto;
    max-width: 1200px;
}
.wrapper { padding: 0 15px; }

/* --- 3. HEADER & TOP BAR --- */
#header {
    background: #ffffff;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
    z-index: 900;
}

#top_bar {
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 5px 15px;
    font-size: 13px;
    color: #6b7280;
    text-align: right;
}

#logo {
    padding: 20px 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- 4. MAIN NAVIGATION (DESKTOP >= 768px) --- */
.header-menu, .widget-title-bg, .widget-title {
    background: linear-gradient(to bottom, #ce34a6 0%, #ab1e88 100%) !important;
    background-color: #ab1e88 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    min-height: 50px;
}

@media (min-width: 768px) {
    #h_menu {
        width: 100%;
        display: flex !important;
        justify-content: center;
        align-items: stretch;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* HOME ICON (Square) */
    .home-icon {
        position: relative !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 50px !important;
        background: rgba(0,0,0,0.1);
        border-right: 1px solid rgba(255,255,255,0.1);
        margin: 0 !important;
        z-index: 10;
        cursor: pointer;
    }
    .home-icon:hover { background: rgba(255,255,255,0.25); }
    .home-icon .glyphicon { font-size: 20px !important; color: #fff !important; top: 0 !important; }

    /* MENU ITEMS */
    #h_menu .level_0 {
        display: flex !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        flex-wrap: wrap; /* Safety for small screens */
    }

    #h_menu .level_0 > li {
        display: flex !important;
        align-items: center;
        position: relative;
    }

    #h_menu .level_0 > li > a {
        color: #fff !important;
        font-weight: 600;
        text-transform: uppercase;
        padding: 0 20px !important;
        height: 50px;
        line-height: 50px;
        display: block;
        font-size: 14px;
        white-space: nowrap;
    }
    #h_menu .level_0 > li:hover { background: rgba(255,255,255,0.2); }

    /* DROPDOWN (Level 1) */
    #h_menu .level_0 ul {
        display: none;
        position: absolute;
        top: 50px;
        left: 0;
        background: #fff;
        min-width: 240px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        padding: 10px 0;
        z-index: 1000;
        border-radius: 0 0 8px 8px;
    }
    #h_menu .level_0 > li:hover > ul { display: block; animation: fadeIn 0.3s; }
    
    #h_menu .level_1 li a {
        color: #374151 !important;
        padding: 10px 20px !important;
        display: block !important;
        text-transform: none;
        text-align: left;
        border-bottom: 1px solid #eee;
        height: auto !important;
        line-height: 1.4 !important;
    }
    #h_menu .level_1 li a:hover {
        background: #f9fafb;
        color: #ab1e88 !important;
        padding-left: 25px !important; /* Visual feedback */
    }
}

/* --- 5. MOBILE NAVIGATION (MOBILE < 767px) --- */
@media (max-width: 767px) {
    /* Hide desktop structure */
    #h_menu { display: none !important; }
    .home-icon { display: none !important; }

    /* Active Mobile Menu (Overlay) */
    #main_nav.active-main_nav #h_menu {
        display: flex !important;
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(76, 18, 129, 0.98) !important; /* High contrast bg */
        z-index: 9999 !important;
        align-items: center;
        justify-content: center;
        padding: 20px !important;
    }

    /* Scrollable Container */
    #h_menu .level_0 {
        background: #fff !important;
        width: 100%;
        max-width: 320px;
        border-radius: 12px;
        padding: 15px !important;
        max-height: 85vh;
        overflow-y: auto;
        display: block !important;
        box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    }

    /* Mobile Links */
    #h_menu .level_0 > li { display: block !important; margin-bottom: 8px; }
    #h_menu .level_0 > li > a { 
        background: #ab1e88 !important;
        color: #fff !important;
        border-radius: 6px;
        text-align: center;
        padding: 12px !important;
        display: block;
        font-weight: 700;
    }
    
    /* Mobile Submenu */
    #h_menu .level_0 ul { display: block !important; padding: 5px 0; margin-bottom: 10px; }
    #h_menu .level_1 li a {
        color: #333 !important;
        border-bottom: 1px solid #eee;
        padding: 10px !important;
        text-align: center;
        font-size: 14px;
        display: block;
    }
}

/* --- 6. CRITICAL FIXES: YANDEX SEARCH --- */
/* (Не менять селекторы - сломается поиск) */
.site_search { margin-bottom: 10px; }
#ya-site-form0 .ya-site-form__search-input { padding: 0 !important; }
#ya-site-form0 .ya-site-form__wrap { table-layout: unset !important; }

.ya-site-form__input-text {
    background: #fff none repeat scroll 0 0 !important;
    color: #555 !important;
    height: 34px !important;
    float: none !important;
    text-transform: none !important;
    border-radius: 30px !important;
    border: 1px solid #ddd !important;
    padding: 7px 15px !important;
    width: 100% !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05) !important;
}

.ya-site-form__submit {
    background: transparent !important;
    border: none !important;
    color: #999 !important;
    height: 28px !important;
    line-height: 100% !important;
    cursor: pointer !important;
    font-size: 12px !important;
    margin-left: 5px !important;
}
.ya-site-form__submit:hover { color: #ab1e88 !important; }
#ya-site-form0 .ya-site-form__gap { display: none !important; }

/* Reset tables inside search to prevent theme conflicts */
#ya-site-form0 table, #ya-site-form0 td, #ya-site-form0 tr {
    border: none !important; background: transparent !important;
    padding: 0 !important; margin: 0 !important;
    box-shadow: none !important; border-radius: 0 !important;
}

/* --- 7. CRITICAL FIXES: FOOTER BANNERS (CLS) --- */
/* Предотвращает прыжки контента при загрузке каруселей */
.owl-carousel .owl-item img, .off-banners img, .banners img {
    width: auto !important; max-width: none !important; 
    height: auto !important; max-height: 70px !important;
    display: inline-block !important; opacity: 1 !important; visibility: visible !important;
    box-shadow: none !important;
}
.owl-item { display: flex !important; align-items: center; justify-content: center; height: 90px !important; }

/* --- 8. WIDGETS & CONTENT TABLES --- */
.aside_box, .widget {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 30px !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #f3f4f6;
    overflow: hidden;
}
.widget-title, .aside_box > h3 {
    padding: 12px 15px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff !important; /* Force white text on purple bg */
    margin: 0;
}

/* Beautiful Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1em;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #E5E7EB;
}
table td, table th { padding: 12px 15px; border-bottom: 1px solid #E5E7EB; }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background-color: #f9fafb; }

/* --- 9. ICONS (GLYPHICONS) --- */
/* Load securely via HTTPS */
@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('https://netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.eot');
  src: url('https://netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), 
       url('https://netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.woff') format('woff'), 
       url('https://netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/glyphicons-halflings-regular.ttf') format('truetype');
  font-display: swap; /
}
.glyphicon { display: inline-block; font-family: 'Glyphicons Halflings'; font-style: normal; line-height: 1; position: relative; }
.glyphicon-home:before { content: "\e021"; }

/* --- 10. FOOTER --- */
#footer {
    background: #1F2937;
    color: #9CA3AF;
    padding: 40px 0;
    margin-top: 40px;
    font-size: 14px;
}
#footer a { color: #D1D5DB; }
#footer a:hover { color: #fff; }
#footer h5 { color: #fff; margin-bottom: 20px; font-weight: 600; text-transform: uppercase; }

/* Animation helper */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }