/**
 * Danguy Mega Menu - Frontend Styles
 * Thiết kế Mega Menu giống daotao.namsaigon.edu.vn (Jannah theme)
 * 
 * @package DangUy
 * @version 2.8.1
 */

/* ========================
   MEGA MENU BASE
======================== */

/* Menu Item with Custom Color */
.nav-menu > li.has-custom-color > a {
    color: var(--menu-item-color, #fff) !important;
}

.nav-menu > li.has-custom-color > a:hover {
    background: rgba(255,255,255,0.15);
}

/* Icon Only */
.nav-menu > li.icon-only > a .menu-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nav-menu > li.icon-only > a .menu-icon {
    margin: 0;
    font-size: 18px;
}

/* Menu Icon */
.nav-menu > li > a .menu-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    font-size: 14px;
}

.nav-menu > li > a .menu-icon i {
    padding: 0;
}

/* Menu Text */
.nav-menu > li > a .menu-text {
    display: inline;
}

/* Menu Label Badge */
.menu-label {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    margin-left: 6px;
    border-radius: 3px;
    color: #fff;
    line-height: 1.2;
    animation: labelPulse 2s ease-in-out infinite;
    vertical-align: middle;
    letter-spacing: 0.5px;
    position: relative;
    top: -1px;
}

@keyframes labelPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.05); }
}

/* Menu Arrow Indicator */
.menu-arrow {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    font-size: 10px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-arrow i {
    padding: 0 !important;
    font-size: 10px;
}

.nav-menu > li:hover > a .menu-arrow,
.nav-menu > li.mega-open > a .menu-arrow {
    transform: rotate(180deg);
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================
   MEGA MENU CONTAINER
======================== */
.mega-menu-container {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    width: 100vw;
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    border-top: 3px solid var(--dg-primary, #8B0000);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, 
                visibility 0.25s ease, 
                transform 0.25s ease;
    z-index: 1000;
    border-radius: 0;
    overflow: hidden;
}

/* Position mega menu relative to nav container */
.nav-menu > li.has-mega-menu {
    position: static;
}

.main-nav .container {
    position: relative;
}

/* Show mega menu on hover */
.nav-menu > li.has-mega-menu:hover > .mega-menu-container,
.nav-menu > li.has-mega-menu.mega-open > .mega-menu-container {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Hide default WordPress submenu for mega menu items */
.nav-menu > li.has-mega-menu > .sub-menu {
    display: none !important;
}

/* Mega Menu Inner */
.mega-menu-inner {
    padding: 0;
    max-width: 100%;
    margin: 0;
}

/* ========================
   MEGA QUICK LINKS
   (Top row sub-category links) 
   Giống mega-cat-more-links của Jannah
======================== */
.mega-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e5e7eb;
}

.mega-quick-link-item {
    margin: 0;
}

.mega-quick-link-item a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    text-decoration: none;
    transition: all 0.2s ease;
    border-right: 1px solid rgba(0,0,0,0.06);
    white-space: nowrap;
}

.mega-quick-link-item a i {
    font-size: 13px;
    color: var(--dg-primary, #8B0000);
    padding: 0;
    width: 16px;
    text-align: center;
}

.mega-quick-link-item a:hover {
    background: var(--dg-primary, #8B0000);
    color: #fff;
}

.mega-quick-link-item a:hover i {
    color: #fff;
}

.mega-quick-link-item:last-child a {
    border-right: none;
}

/* ========================
   MEGA CAT WRAPPER
   (Main content area with sidebar + posts)
======================== */
.mega-cat-wrapper {
    display: flex;
    gap: 0;
    min-height: 300px;
}

/* ========================
   MEGA LAYOUT - VERTICAL
   (Posts with Sidebar Categories - mega-cat style)
======================== */
.mega-layout-vertical {
    display: flex;
    flex-direction: column;
}

.mega-layout-vertical .mega-sidebar {
    flex: 0 0 200px;
    background: #f8f9fa;
    border-right: 1px solid #e5e7eb;
}

.mega-sidebar-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    padding: 12px 16px;
    background: var(--dg-primary, #8B0000);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mega-sidebar-title i {
    font-size: 12px;
    padding: 0;
}

.mega-category-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.mega-cat-item {
    margin: 0;
}

.mega-cat-item a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #444;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    border-left: 3px solid transparent;
    gap: 8px;
    cursor: pointer;
}

.mega-cat-item a i {
    margin-right: 0;
    color: #aaa;
    font-size: 11px;
    transition: all 0.2s ease;
    width: 14px;
    text-align: center;
    padding: 0;
    flex-shrink: 0;
}

.mega-cat-item a span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mega-cat-item:hover a {
    background: var(--dg-primary, #8B0000);
    color: #fff;
    border-left-color: var(--dg-accent, #ffd54f);
}

.mega-cat-item:hover a i {
    color: var(--dg-accent, #ffd54f);
}

.mega-cat-item.active a {
    background: var(--dg-primary, #8B0000);
    color: #fff;
    border-left-color: var(--dg-accent, #ffd54f);
    font-weight: 600;
}

.mega-cat-item.active a i {
    color: var(--dg-accent, #ffd54f);
}

.mega-layout-vertical .mega-content {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
}

/* ========================
   MEGA LAYOUT - HORIZONTAL
   (Posts with Tab Categories)
======================== */
.mega-layout-horizontal {
    display: flex;
    flex-direction: column;
    padding: 10px 15px;
}

.mega-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e5e5;
    margin-bottom: 10px;
    gap: 12px;
}

.mega-header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dg-primary, #8B0000);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    position: relative;
    padding-left: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mega-header-title i {
    padding: 0;
    font-size: 14px;
}

.mega-header-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    background: var(--dg-primary, #8B0000);
    border-radius: 2px;
}

.mega-tabs {
    display: flex;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.mega-tab a {
    display: block;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    background: #f0f1f3;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 1px solid transparent;
    cursor: pointer;
}

.mega-tab:hover a {
    background: var(--dg-primary-light, #c62828);
    color: #fff;
    border-color: var(--dg-primary-light, #c62828);
}

.mega-tab.active a {
    background: var(--dg-primary, #8B0000);
    color: #fff;
    border-color: var(--dg-primary, #8B0000);
    font-weight: 600;
}

/* ========================
   MEDIA OVERLAY POST CARDS
   Giống style mega-cat-posts của Jannah
   (Title & date overlay trên ảnh)
======================== */
.mega-media-overlay {
    display: grid;
    gap: 8px;
}

.mega-cols-1 .mega-media-overlay { grid-template-columns: 1fr; }
.mega-cols-2 .mega-media-overlay { grid-template-columns: repeat(2, 1fr); }
.mega-cols-3 .mega-media-overlay { grid-template-columns: repeat(3, 1fr); }
.mega-cols-4 .mega-media-overlay { grid-template-columns: repeat(4, 1fr); }
.mega-cols-5 .mega-media-overlay { grid-template-columns: repeat(5, 1fr); }
.mega-cols-6 .mega-media-overlay { grid-template-columns: repeat(6, 1fr); }

.mega-content[data-columns="1"] .mega-media-overlay { grid-template-columns: 1fr; }
.mega-content[data-columns="2"] .mega-media-overlay { grid-template-columns: repeat(2, 1fr); }
.mega-content[data-columns="3"] .mega-media-overlay { grid-template-columns: repeat(3, 1fr); }
.mega-content[data-columns="4"] .mega-media-overlay { grid-template-columns: repeat(4, 1fr); }
.mega-content[data-columns="5"] .mega-media-overlay { grid-template-columns: repeat(5, 1fr); }
.mega-content[data-columns="6"] .mega-media-overlay { grid-template-columns: repeat(6, 1fr); }

.mega-overlay-card {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.mega-overlay-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    transform: translateY(-2px);
}

.mega-overlay-link {
    display: block;
    position: relative;
    text-decoration: none;
    color: #fff;
    height: 100%;
}

.mega-overlay-thumb {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #e9ecef;
}

.mega-overlay-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.mega-overlay-card:hover .mega-overlay-thumb img {
    transform: scale(1.08);
}

.mega-overlay-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: rgba(255,255,255,0.3);
    font-size: 40px;
}

.mega-overlay-thumb-placeholder i {
    padding: 0;
}

/* Gradient overlay on image */
.mega-overlay-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 40%, transparent 100%);
    pointer-events: none;
    z-index: 1;
    border-radius: 0 0 6px 6px;
}

/* Info overlay (bottom of card) */
.mega-overlay-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 10px;
    z-index: 2;
    color: #fff;
}

.mega-overlay-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 4px;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.mega-overlay-date {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    gap: 4px;
}

.mega-overlay-date i {
    font-size: 10px;
    padding: 0;
}

/* ========================
   MEGA LAYOUT - HIGHLIGHTED
   (Featured Post + List)
======================== */
.mega-layout-highlighted {
    display: flex;
    gap: 15px;
    min-height: 280px;
    padding: 12px 15px;
}

.mega-featured {
    flex: 0 0 45%;
    max-width: 45%;
}

.mega-post-featured {
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    height: 100%;
    transition: box-shadow 0.3s ease;
}

.mega-post-featured:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.mega-post-featured .mega-post-thumb {
    display: block;
    overflow: hidden;
    position: relative;
}

.mega-post-featured .mega-post-thumb img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.mega-post-featured:hover .mega-post-thumb img {
    transform: scale(1.05);
}

.mega-post-featured .mega-post-thumb::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, rgba(0,0,0,0.1));
    pointer-events: none;
}

.mega-post-featured .mega-post-info {
    padding: 16px 18px;
}

.mega-post-featured .mega-post-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.45;
}

.mega-post-featured .mega-post-title a {
    color: #222;
    text-decoration: none;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mega-post-featured .mega-post-title a:hover {
    color: var(--dg-primary, #8B0000);
}

.mega-post-featured .mega-post-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin: 10px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Posts List (right side of highlighted) */
.mega-posts-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mega-post-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #eef0f3;
    transition: background 0.2s ease;
}

.mega-post-item:first-child {
    padding-top: 0;
}

.mega-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.mega-post-item:hover {
    background: rgba(0,0,0,0.01);
}

.mega-post-item .mega-post-thumb {
    flex: 0 0 90px;
    border-radius: 6px;
    overflow: hidden;
}

.mega-post-item .mega-post-thumb img {
    width: 90px;
    height: 60px;
    object-fit: cover;
    transition: transform 0.4s ease;
    border-radius: 6px;
}

.mega-post-item:hover .mega-post-thumb img {
    transform: scale(1.08);
}

.mega-post-item .mega-post-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mega-post-item .mega-post-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 5px;
    line-height: 1.45;
}

.mega-post-item .mega-post-title a {
    color: #333;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.mega-post-item .mega-post-title a:hover {
    color: var(--dg-primary, #8B0000);
}

/* ========================
   MEGA LAYOUT - COLUMNS
   (Multi-column Links - mega-links style)
======================== */
.mega-layout-columns {
    display: flex;
    flex-direction: column;
    padding: 12px 15px;
}

.mega-columns-grid {
    display: grid;
    gap: 20px;
}

.mega-cols-1 .mega-columns-grid { grid-template-columns: repeat(1, 1fr); }
.mega-cols-2 .mega-columns-grid { grid-template-columns: repeat(2, 1fr); }
.mega-cols-3 .mega-columns-grid { grid-template-columns: repeat(3, 1fr); }
.mega-cols-4 .mega-columns-grid { grid-template-columns: repeat(4, 1fr); }
.mega-cols-5 .mega-columns-grid { grid-template-columns: repeat(5, 1fr); }
.mega-cols-6 .mega-columns-grid { grid-template-columns: repeat(6, 1fr); }

.mega-column {
    position: relative;
}

.mega-column::after {
    content: '';
    position: absolute;
    right: -15px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #eef0f3;
}

.mega-column:last-child::after {
    display: none;
}

.mega-column-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--dg-primary, #8B0000);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--dg-primary, #8B0000);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mega-column-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mega-column-title a:hover {
    color: var(--dg-primary-light, #c62828);
}

.mega-column-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-column-links li {
    margin-bottom: 2px;
}

.mega-column-links a {
    display: flex;
    align-items: center;
    padding: 7px 0 7px 0;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.mega-column-links a::before {
    content: '\f105';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: #ccc;
    margin-right: 8px;
    transition: all 0.2s ease;
    width: 12px;
    flex-shrink: 0;
}

.mega-column-links a:hover {
    color: var(--dg-primary, #8B0000);
    padding-left: 5px;
}

.mega-column-links a:hover::before {
    color: var(--dg-primary, #8B0000);
}

/* ========================
   POSTS GRID (fallback/alternative)
======================== */
.mega-posts-grid:not(.mega-media-overlay) {
    display: grid;
    gap: 16px;
}

.mega-cols-1 .mega-posts-grid:not(.mega-media-overlay),
.mega-content[data-columns="1"] .mega-posts-grid:not(.mega-media-overlay) { grid-template-columns: 1fr; }
.mega-cols-2 .mega-posts-grid:not(.mega-media-overlay),
.mega-content[data-columns="2"] .mega-posts-grid:not(.mega-media-overlay) { grid-template-columns: repeat(2, 1fr); }
.mega-cols-3 .mega-posts-grid:not(.mega-media-overlay),
.mega-content[data-columns="3"] .mega-posts-grid:not(.mega-media-overlay) { grid-template-columns: repeat(3, 1fr); }
.mega-cols-4 .mega-posts-grid:not(.mega-media-overlay),
.mega-content[data-columns="4"] .mega-posts-grid:not(.mega-media-overlay) { grid-template-columns: repeat(4, 1fr); }
.mega-cols-5 .mega-posts-grid:not(.mega-media-overlay),
.mega-content[data-columns="5"] .mega-posts-grid:not(.mega-media-overlay) { grid-template-columns: repeat(5, 1fr); }
.mega-cols-6 .mega-posts-grid:not(.mega-media-overlay),
.mega-content[data-columns="6"] .mega-posts-grid:not(.mega-media-overlay) { grid-template-columns: repeat(6, 1fr); }

/* Post Card (fallback non-overlay) */
.mega-post-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #eef0f3;
}

.mega-post-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    border-color: transparent;
}

.mega-post-card .mega-post-thumb {
    display: block;
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
}

.mega-post-card .mega-post-thumb img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.mega-post-card:hover .mega-post-thumb img {
    transform: scale(1.08);
}

.mega-post-card .mega-post-info {
    padding: 14px;
}

.mega-post-card .mega-post-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mega-post-card .mega-post-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mega-post-card .mega-post-title a:hover {
    color: var(--dg-primary, #8B0000);
}

.mega-post-meta {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mega-post-meta i {
    margin-right: 3px;
    font-size: 10px;
    color: #bbb;
    padding: 0;
}

/* No posts message */
.no-posts {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 40px 20px;
    grid-column: 1 / -1;
}

.no-posts i {
    padding: 0;
    margin-right: 6px;
}

/* ========================
   PAGINATION
======================== */
.mega-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eef0f3;
}

.mega-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.mega-nav-btn i {
    padding: 0;
}

.mega-nav-btn:hover:not(:disabled) {
    background: var(--dg-primary, #8B0000);
    color: #fff;
    border-color: var(--dg-primary, #8B0000);
    transform: scale(1.05);
}

.mega-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #fafafa;
}

.mega-page-info {
    font-size: 12px;
    color: #666;
    min-width: 60px;
    text-align: center;
    font-weight: 500;
}

/* ========================
   LOADING STATE
======================== */
.mega-content.loading {
    position: relative;
    min-height: 200px;
}

.mega-content.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.75);
    z-index: 5;
    border-radius: 8px;
}

.mega-content.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid #e5e5e5;
    border-top-color: var(--dg-primary, #8B0000);
    border-radius: 50%;
    animation: megaSpin 0.7s linear infinite;
    z-index: 10;
}

.mega-content.loading .mega-posts-grid,
.mega-content.loading .mega-ajax-posts {
    opacity: 0.3;
    pointer-events: none;
}

@keyframes megaSpin {
    to { transform: rotate(360deg); }
}

/* Skeleton loading */
.mega-skeleton {
    display: grid;
    gap: 12px;
}

.mega-skeleton-card {
    border-radius: 10px;
    overflow: hidden;
    background: #f0f0f0;
    animation: megaPulse 1.5s ease-in-out infinite;
}

.mega-skeleton-card .skeleton-thumb {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: megaShimmer 1.5s ease-in-out infinite;
}

.mega-skeleton-card .skeleton-text {
    padding: 12px;
}

.mega-skeleton-card .skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: megaShimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 6px;
}

.mega-skeleton-card .skeleton-line:last-child {
    width: 60%;
}

@keyframes megaPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes megaShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ========================
   RESPONSIVE
======================== */

/* Tablet */
@media (max-width: 1200px) {
    .mega-layout-vertical .mega-sidebar {
        flex: 0 0 175px;
    }
    
    .mega-overlay-thumb {
        height: 160px;
    }
    
    .mega-post-card .mega-post-thumb img {
        height: 120px;
    }
}

/* Mobile & Tablet Portrait */
@media (max-width: 991px) {
    /* Container changes for mobile slide-up panel */
    .mega-menu-container {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 75vh;
        overflow-y: auto;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        border-top: none;
        box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.2);
    }
    
    .mega-menu-container::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 12px auto 8px;
    }
    
    .nav-menu > li.has-mega-menu:hover > .mega-menu-container,
    .nav-menu > li.has-mega-menu.mega-open > .mega-menu-container {
        transform: translateY(0);
    }
    
    .mega-menu-inner {
        padding: 0;
    }
    
    /* Quick links wrap on mobile */
    .mega-quick-links {
        flex-wrap: wrap;
    }
    
    .mega-quick-link-item a {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    /* Mega cat wrapper stacks */
    .mega-cat-wrapper {
        flex-direction: column;
        min-height: 0;
    }
    
    /* Vertical layout stacks */
    .mega-layout-vertical {
        flex-direction: column;
        min-height: 0;
    }
    
    .mega-layout-vertical .mega-sidebar {
        flex: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .mega-layout-vertical .mega-content {
        padding: 12px 14px;
    }
    
    .mega-category-list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 10px;
    }
    
    .mega-cat-item a {
        padding: 6px 12px;
        border-radius: 20px;
        border: 1px solid #e0e0e0;
        border-left: none;
        font-size: 12px;
    }
    
    .mega-cat-item.active a,
    .mega-cat-item:hover a {
        border-color: var(--dg-primary, #8B0000);
    }
    
    .mega-sidebar-title {
        padding: 10px 14px;
    }
    
    /* Highlighted layout stacks */
    .mega-layout-highlighted {
        flex-direction: column;
        padding: 14px;
    }
    
    .mega-featured {
        flex: none;
        width: 100%;
        max-width: 100%;
    }
    
    .mega-post-featured .mega-post-thumb img {
        height: 180px;
    }
    
    /* Horizontal layout */
    .mega-layout-horizontal {
        padding: 12px 14px;
    }
    
    /* Grid responsive */
    .mega-media-overlay,
    .mega-posts-grid:not(.mega-media-overlay) {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    .mega-overlay-thumb {
        height: 150px;
    }
    
    .mega-columns-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .mega-column::after {
        display: none;
    }
    
    /* Tabs wrap */
    .mega-tabs {
        flex-wrap: wrap;
    }
    
    .mega-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .mega-tab a {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Hide menu-arrow on mobile - mobile-sub-toggle handles this */
    .nav-menu > li.has-mega-menu > a .menu-arrow {
        display: none !important;
    }
    
    /* Columns layout */
    .mega-layout-columns {
        padding: 14px;
    }
}

/* Phone */
@media (max-width: 576px) {
    .mega-quick-link-item a {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .mega-media-overlay,
    .mega-posts-grid:not(.mega-media-overlay) {
        grid-template-columns: 1fr !important;
    }
    
    .mega-overlay-thumb {
        height: 180px;
    }
    
    .mega-columns-grid {
        grid-template-columns: 1fr !important;
    }
    
    .mega-post-card .mega-post-thumb img {
        height: 160px;
    }
    
    .mega-post-featured .mega-post-thumb img {
        height: 160px;
    }
    
    .mega-post-item .mega-post-thumb {
        flex: 0 0 70px;
    }
    
    .mega-post-item .mega-post-thumb img {
        width: 70px;
        height: 50px;
    }
}

/* ========================
   MEGA MENU OVERLAY (mobile)
======================== */
.mega-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mega-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================
   ACCESSIBILITY
======================== */
.mega-menu-container:focus-within {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-cat-item a:focus,
.mega-tab a:focus,
.mega-column-links a:focus,
.mega-post-card a:focus,
.mega-overlay-link:focus,
.mega-quick-link-item a:focus,
.mega-nav-btn:focus {
    outline: 2px solid var(--dg-primary, #8B0000);
    outline-offset: 2px;
}

/* ========================
   ANIMATION
======================== */
@keyframes megaFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.mega-ajax-posts {
    animation: megaFadeIn 0.3s ease;
}

/* ========================
   PRINT STYLES
======================== */
@media print {
    .mega-menu-container {
        display: none !important;
    }
}
