/**
 * NEJRÁMY Design - Frontend Styles
 *
 * Styly pro shortcodes a frontend zobrazení produktů rámů na kamiony.
 *
 * @package Nejramy_Design
 * @since 2.0.0
 */

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    --nejramy-primary: #0D4689;
    --nejramy-primary-hover: #2c5282;
    --nejramy-secondary: #e53e3e;
    --nejramy-text: #2d3748;
    --nejramy-text-light: #718096;
    --nejramy-border: #e2e8f0;
    --nejramy-bg-light: #f7fafc;
    --nejramy-white: #ffffff;
    --nejramy-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --nejramy-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --nejramy-radius: 8px;
    --nejramy-radius-sm: 4px;
    /* Mobile breakpoint - single source of truth */
    --nejramy-mobile-breakpoint: 768px;
}

/* ==========================================================================
   Homepage Shortcode (style nejramy.cz)
   ========================================================================== */

.nejramy-homepage {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.nejramy-homepage-section {
    margin-bottom: 3rem;
}

.nejramy-homepage-section-title {
    font-size: 1.75rem;
    color: rgb(13, 70, 137);
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--nejramy-border);
}

/* Homepage Grid - style nejramy.cz */
.nejramy-homepage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 220px);
    gap: 25px;
    justify-content: center;
}

/* Brands Grid - 3 columns, full width */
.nejramy-homepage-brands .nejramy-homepage-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* Homepage Card */
.nejramy-homepage-card {
    display: block;
    background: var(--nejramy-white);
    border: 1px solid var(--nejramy-border);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.nejramy-homepage-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.nejramy-homepage-card--brand {
    display: flex;
    flex-direction: column;
}

.nejramy-homepage-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.nejramy-homepage-card-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--nejramy-bg-light);
    min-height: 120px;
}

.nejramy-homepage-card-img {
    width: 50%;
    height: auto;
    max-height: 100px;
    object-fit: contain;
}

.nejramy-homepage-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nejramy-text-light);
}

.nejramy-homepage-card-placeholder .dashicons {
    font-size: 3rem;
    width: 3rem;
    height: 3rem;
}

.nejramy-homepage-card-content {
    padding: 1rem;
    text-align: center;
}

.nejramy-homepage-card-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: rgb(13, 70, 137);
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.nejramy-homepage-card-count {
    font-size: 0.875rem;
    color: var(--nejramy-text-light);
}

/* Brand Card Models */
.nejramy-homepage-card-models {
    padding: 0.75rem 1rem;
    background: var(--nejramy-bg-light);
    border-top: 1px solid var(--nejramy-border);
}

.nejramy-homepage-card-models-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.nejramy-homepage-card-models-list li {
    margin: 0;
}

.nejramy-homepage-card-models-list a {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: rgb(13, 70, 137);
    text-decoration: none;
    background: var(--nejramy-white);
    border-radius: var(--nejramy-radius-sm);
    transition: background 0.2s, color 0.2s;
}

.nejramy-homepage-card-models-list a:hover {
    background: rgb(13, 70, 137);
    color: var(--nejramy-white);
}

.nejramy-model-count {
    opacity: 0.7;
    margin-left: 0.25rem;
}

/* Homepage Responsive */
@media (max-width: 991px) {
    .nejramy-homepage-brands .nejramy-homepage-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 767px) {
    .nejramy-homepage {
        padding: 0;
    }

    .nejramy-homepage-section {
        margin-bottom: 0.1rem;
    }

    .nejramy-homepage-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .nejramy-homepage-brands .nejramy-homepage-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .nejramy-homepage-section-title {
        font-size: 1rem;
        margin-bottom: 0.1rem;
        padding-bottom: 0.1rem;
    }

    .nejramy-homepage-card-title {
        font-size: 0.85rem;
    }

    .nejramy-homepage-card-image {
        padding: 10px;
        min-height: 80px;
    }

    .nejramy-homepage-card-img {
        max-height: 60px;
    }

    .nejramy-homepage-card-content {
        padding: 0.1rem;
    }
}

@media (max-width: 480px) {
    .nejramy-homepage-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .nejramy-homepage-brands .nejramy-homepage-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .nejramy-homepage-card-content {
        padding: 0.75rem;
    }

    .nejramy-homepage-card-title {
        font-size: 0.85rem;
    }
}

/* ==========================================================================
   Horizontal Menu Shortcode
   ========================================================================== */

.nejramy-menu {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

/* Mobile Label (hidden on desktop) */
.nejramy-menu-mobile-label {
    display: none;
}

/* Hamburger Toggle Button */
.nejramy-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 1rem;
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10001;
    width: 44px;
    height: 44px;
}

.nejramy-menu-toggle-icon,
.nejramy-menu-toggle-icon::before,
.nejramy-menu-toggle-icon::after {
    display: block;
    background: rgb(13, 70, 137);
    height: 3px;
    width: 24px;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nejramy-menu-toggle-icon {
    position: relative;
}

.nejramy-menu-toggle-icon::before,
.nejramy-menu-toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.nejramy-menu-toggle-icon::before {
    top: -7px;
}

.nejramy-menu-toggle-icon::after {
    top: 7px;
}

/* Hamburger to X animation - active state with blue background and white X */
.nejramy-menu--open .nejramy-menu-toggle {
    background: rgb(13, 70, 137) !important;
    border-radius: 4px;
}

.nejramy-menu--open .nejramy-menu-toggle-icon {
    background: transparent;
}

.nejramy-menu--open .nejramy-menu-toggle-icon::before,
.nejramy-menu--open .nejramy-menu-toggle-icon::after {
    background: #ffffff;
}

.nejramy-menu--open .nejramy-menu-toggle-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.nejramy-menu--open .nejramy-menu-toggle-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

.nejramy-menu-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    width: 100% !important;
    max-width: 1200px !important;
}

.nejramy-menu-item {
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.nejramy-menu-item > a {
    display: block !important;
    padding: 0.82rem 0.7rem !important;
    color: rgb(13, 70, 137) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 0.93rem !important;
    transition: background 0.2s, color 0.2s !important;
    line-height: 1.4 !important;
}

.nejramy-menu-item > a:hover,
.nejramy-menu-item--has-submenu:hover > a {
    background: rgb(13, 70, 137) !important;
    color: #ffffff !important;
}

/* Submenu - Dropdown */
.nejramy-submenu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    min-width: 280px !important;
    background: #ffffff !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    border-radius: 0 0 8px 8px !important;
    list-style: none !important;
    padding: 0.5rem 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s !important;
    z-index: 9999 !important;
    display: block !important;
    flex-direction: column !important;
}

.nejramy-menu-item--has-submenu:hover > .nejramy-submenu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.nejramy-submenu-item {
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    display: block !important;
    width: 100% !important;
    list-style: none !important;
}

.nejramy-submenu-item > a {
    display: block !important;
    padding: 0.6rem 1.25rem !important;
    color: #2d3748 !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    transition: background 0.2s, color 0.2s !important;
    white-space: nowrap !important;
}

.nejramy-submenu-item > a:hover {
    background: #f7fafc !important;
    color: rgb(13, 70, 137) !important;
}

.nejramy-menu-count {
    font-size: 0.8em !important;
    opacity: 0.6 !important;
    margin-left: 0.25rem !important;
}

/* Menu Arrow for dropdowns */
.nejramy-menu-arrow {
    font-size: 0.5em;
    vertical-align: middle;
    margin-left: 0.25rem;
}

/* Nested submenu for brand models */
.nejramy-submenu-item--has-children > a::after {
    content: "›";
    float: right;
    margin-left: 0.5rem;
    font-weight: bold;
}

.nejramy-submenu-children {
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 250px;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 1001;
}

.nejramy-submenu-item--has-children:hover > .nejramy-submenu-children {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nejramy-submenu-children li {
    margin: 0;
}

.nejramy-submenu-children a {
    display: block;
    padding: 0.5rem 1.25rem;
    color: var(--nejramy-text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s;
}

.nejramy-submenu-children a:hover {
    background: var(--nejramy-bg-light);
    color: rgb(13, 70, 137);
}

/* ==========================================================================
   Grouped Category Sidebar
   ========================================================================== */

.nejramy-category-list--grouped {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.nejramy-category-group {
    margin-bottom: 1rem !important;
    list-style: none !important;
}

.nejramy-category-group:last-child {
    margin-bottom: 0 !important;
}

.nejramy-category-group-title {
    display: block !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    color: var(--nejramy-primary) !important;
    padding: 0.5rem 0 !important;
    border-bottom: 1px solid var(--nejramy-border) !important;
    margin-bottom: 0.5rem !important;
}

.nejramy-category-group-children {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 0 0.75rem !important;
}

.nejramy-category-group-children li {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.nejramy-category-group-children a {
    display: block !important;
    padding: 0.4rem 0.5rem !important;
    font-size: 0.875rem !important;
    color: var(--nejramy-text) !important;
    text-decoration: none !important;
    border-radius: var(--nejramy-radius-sm) !important;
    transition: background 0.2s, color 0.2s !important;
}

.nejramy-category-group-children a:hover {
    background: var(--nejramy-bg-light) !important;
    color: var(--nejramy-primary) !important;
}

.nejramy-category-group-children li.current a {
    background: var(--nejramy-primary) !important;
    color: var(--nejramy-white) !important;
    font-weight: 500 !important;
}

/* Active group highlight */
.nejramy-category-group--active > .nejramy-category-group-title {
    color: var(--nejramy-primary) !important;
    border-bottom-color: var(--nejramy-primary) !important;
}

/* Mobile responsive for grouped sidebar */
@media (max-width: 768px) {
    .nejramy-category-group {
        margin-bottom: 0.75rem !important;
    }

    .nejramy-category-group-title {
        font-size: 0.9rem !important;
        padding: 0.4rem 0 !important;
    }

    .nejramy-category-group-children {
        margin-left: 0.5rem !important;
    }

    .nejramy-category-group-children a {
        font-size: 0.85rem !important;
        padding: 0.35rem 0.4rem !important;
    }
}

/* ==========================================================================
   Filter Buttons - Outline Style
   ========================================================================== */

.nejramy-filter-btn {
    background: transparent;
    border: 1px solid var(--nejramy-primary);
    border-radius: var(--nejramy-radius);
    color: var(--nejramy-primary);
    text-decoration: none;
}

.nejramy-filter-btn:hover {
    background: var(--nejramy-primary);
    color: var(--nejramy-white);
}

.nejramy-filter-btn:active,
.nejramy-filter-btn.active {
    background: var(--nejramy-primary);
    color: var(--nejramy-white);
}

/* Products Shortcode - align filter with sidebar */
.nejramy-archive-layout .nejramy-filters:first-child {
    margin-top: 1.5rem;
}

/* ==========================================================================
   Collapsible Sidebar for Mobile
   ========================================================================== */

.nejramy-sidebar-toggle {
    display: none;
    width: 100%;
    background: var(--nejramy-primary);
    color: var(--nejramy-white);
    border: none;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--nejramy-radius);
    text-align: left;
    position: relative;
}

.nejramy-sidebar-toggle::after {
    content: "▼";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75em;
    transition: transform 0.3s ease;
}

.nejramy-sidebar-toggle.active::after {
    transform: translateY(-50%) rotate(180deg);
}

.nejramy-sidebar-content {
    display: block;
}

@media (max-width: 768px) {
    /* Hide sidebar on mobile - use hamburger menu for navigation */
    .nejramy-archive-sidebar {
        display: none !important;
    }

    .nejramy-sidebar-toggle {
        display: none !important;
    }

    /* Reduce spacing on mobile for faster content visibility */
    .nejramy-archive-header {
        padding: 0.13rem 0 !important;
        margin-bottom: 0.13rem !important;
        border-bottom: none !important;
        text-align: left !important;
    }

    .nejramy-archive-title {
        font-size: 1.2rem !important;
        margin: 0 !important;
        padding: 0 !important;
        text-align: left !important;
    }

    .nejramy-filters {
        margin-bottom: 0.1rem !important;
    }

    .nejramy-brand-filter,
    .nejramy-model-filter {
        padding: 0.1rem !important;
        margin-bottom: 0.1rem !important;
    }

    .nejramy-archive-wrapper {
        padding: 0 0.5rem !important;
    }

    /* Products grid - 2 columns on mobile */
    .nejramy-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .nejramy-product-card-title {
        font-size: 0.75rem !important;
    }
}

/* Menu Responsive */
@media (max-width: 992px) {
    .nejramy-menu-item > a {
        padding: 0.875rem 1rem !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 768px) {
    .nejramy-menu {
        min-height: 56px;
    }

    /* Mobile label "Vyberte produkt" */
    .nejramy-menu-mobile-label {
        display: block !important;
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        color: rgb(13, 70, 137) !important;
        text-align: right !important;
        line-height: 1.2 !important;
        margin-right: 0.75rem !important;
    }

    .nejramy-menu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #ffffff !important;
        border: none !important;
        border-radius: 4px;
    }

    /* Hamburger icon - default state: blue lines */
    .nejramy-menu-toggle-icon,
    .nejramy-menu-toggle-icon::before,
    .nejramy-menu-toggle-icon::after {
        background: rgb(13, 70, 137) !important;
    }

    .nejramy-menu-list {
        display: none !important;
        flex-direction: column !important;
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        background: #ffffff !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
        z-index: 10000 !important;
        max-height: calc(100vh - 56px) !important;
        overflow-y: auto !important;
    }

    .nejramy-menu--open .nejramy-menu-list {
        display: flex !important;
    }

    .nejramy-menu-item {
        width: 100% !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    .nejramy-menu-item > a {
        padding: 1rem 1.25rem !important;
        border-bottom: none !important;
        text-align: right !important;
    }

    .nejramy-submenu {
        position: static !important;
        min-width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: #f7fafc !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        max-height: 0 !important;
        overflow: hidden !important;
        transition: max-height 0.3s ease !important;
        padding: 0 !important;
    }

    .nejramy-menu-item--has-submenu:hover > .nejramy-submenu,
    .nejramy-menu-item--has-submenu:focus-within > .nejramy-submenu,
    .nejramy-menu-item--has-submenu.nejramy-submenu-open > .nejramy-submenu {
        max-height: 2000px !important;
        padding: 0.5rem 0 !important;
    }

    .nejramy-submenu-item > a {
        color: #2d3748 !important;
        padding: 0.75rem 1.25rem !important;
        text-align: right !important;
    }

    .nejramy-submenu-item > a:hover {
        background: #edf2f7 !important;
        color: rgb(13, 70, 137) !important;
    }

    .nejramy-submenu-children {
        position: static !important;
        min-width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: #edf2f7 !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        max-height: 0 !important;
        overflow: hidden !important;
    }

    .nejramy-submenu-item--has-children:hover > .nejramy-submenu-children {
        max-height: 500px !important;
    }

    .nejramy-submenu-children a {
        color: #2d3748 !important;
        padding: 0.5rem 1.25rem !important;
        text-align: right !important;
    }

    .nejramy-submenu-children a:hover {
        background: #e2e8f0 !important;
        color: rgb(13, 70, 137) !important;
    }

    .nejramy-submenu-item--has-children > a::after {
        content: "▼" !important;
        font-size: 0.6em !important;
    }

    /* Mobile menu header with right-aligned hamburger */
    .nejramy-menu {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        padding-right: 1rem !important;
    }

    .nejramy-menu-toggle {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
    }

    /* Mobile menu: larger font (+20%) */
    .nejramy-menu-item > a {
        font-size: 1.15rem !important;
    }

    .nejramy-submenu-item > a {
        font-size: 1.08rem !important;
    }

    /* Mobile: Active hamburger state - blue background, white X */
    .nejramy-menu--open .nejramy-menu-toggle {
        background: rgb(13, 70, 137) !important;
    }

    .nejramy-menu--open .nejramy-menu-toggle-icon {
        background: transparent !important;
    }

    .nejramy-menu--open .nejramy-menu-toggle-icon::before,
    .nejramy-menu--open .nejramy-menu-toggle-icon::after {
        background: #ffffff !important;
    }
}
