/**
 * SeaHawk Rippa - Mega Menu Styles
 *
 * Premium dropdown mega menu with AJAX-loaded content.
 *
 * @package SeaHawk_Rippa
 * @version 2.5.0
 */

/* ============================================================
   1. Top-level menu items with dropdown arrow
   ============================================================ */
.primary-menu > li.has-mega-menu > a .dropdown-arrow {
    display: inline-block;
    font-size: 8px;
    margin-left: 5px;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.primary-menu > li.has-mega-menu:hover > a .dropdown-arrow {
    transform: rotate(180deg);
}

/* ============================================================
   2. Mega Menu Container - fixed panel below header
   ============================================================ */
#mega-menu-container {
    display: none;
    position: fixed;
    left: 0;
    width: 100%;
    background: #fff;
    border-top: none;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    z-index: 101;
    max-height: 480px;
    overflow-y: auto;
}

#mega-menu-container.active {
    display: block;
    animation: megaMenuFadeIn 0.2s ease;
}

@keyframes megaMenuFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Close button */
.mega-menu-close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-light, #6b7280);
    z-index: 10;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mega-menu-close-btn:hover {
    color: var(--color-primary, #1a56db);
}

/* ============================================================
   3. Mega Menu Layout
   ============================================================ */
.mega-menu-wrapper {
    max-width: var(--container-width, 1200px);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.mega-menu-header {
    padding: 16px 0 10px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.mega-menu-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-heading, #111827);
    margin: 0;
}

.mega-menu-content {
    display: flex;
    gap: 32px;
    padding: 20px 0;
    min-height: 200px;
}

/* ============================================================
   4. Sidebar - category info
   ============================================================ */
.mega-menu-sidebar {
    flex: 0 0 220px;
    border-right: 1px solid var(--border-color, #e5e7eb);
    padding-right: 28px;
}

.category-info {
    padding-top: 4px;
}

.category-info h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-heading, #111827);
    margin: 0 0 8px;
}

.category-description {
    font-size: 0.85rem;
    color: var(--color-text-light, #6b7280);
    line-height: 1.6;
    margin-bottom: 12px;
}

.view-all-btn {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary, #1a56db);
    text-decoration: none;
    transition: color 0.2s;
}

.view-all-btn:hover {
    color: var(--color-primary-dark, #1343b0);
    text-decoration: underline;
}

/* ============================================================
   5. Main area - secondary nav + posts grid
   ============================================================ */
.mega-menu-main {
    flex: 1;
    min-width: 0;
}

/* Secondary (child) menu */
.secondary-menu-nav {
    margin-bottom: 16px;
}

.secondary-menu-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.secondary-menu-nav li {
    margin: 0;
}

.secondary-menu-nav a {
    display: block;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text, #374151);
    border-radius: 6px;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.secondary-menu-nav a:hover,
.secondary-menu-nav a.active {
    background: var(--color-primary-light, #e8effd);
    color: var(--color-primary, #1a56db);
}

/* Posts grid */
.posts-grid-container {
    min-height: 120px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.post-placeholder,
.secondary-menu-placeholder {
    color: var(--color-text-light, #9ca3af);
    font-size: 0.9rem;
    text-align: center;
    padding: 40px 20px;
    grid-column: 1 / -1;
}

/* Post/Product cards in mega menu */
.mega-post-card {
    background: var(--color-gray-50, #f9fafb);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color, #e5e7eb);
    transition: all 0.2s;
}

.mega-post-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.mega-post-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.mega-post-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.mega-post-card-body {
    padding: 10px 12px;
}

.mega-post-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-heading, #111827);
    margin: 0 0 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mega-post-card-desc {
    font-size: 0.78rem;
    color: var(--color-text-light, #6b7280);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mega-post-card-type {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-primary, #1a56db);
    margin-bottom: 4px;
}

/* ============================================================
   6. Show mega menu only on desktop
   ============================================================ */
@media (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #mega-menu-container {
        display: none !important; /* fall back to standard mobile menu */
    }

    .primary-menu > li.has-mega-menu > a .dropdown-arrow {
        display: none;
    }
}
