/**
 * Stone Mega Menu - Styles
 * 
 * @package ProStoneManager
 * @since 2.5.0
 */

/* ========================================
   Container & Layout
   ======================================== */

.psm-mega-menu {
    position: relative;
    width: 100%;
}

/* Header */
.psm-mega-menu__header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333333;
}

.psm-mega-menu__header-icon {
    font-size: 18px;
    margin-right: 10px;
    color: inherit;
}

.psm-mega-menu__header-title {
    font-weight: inherit;
    color: inherit;
}

/* Container */
.psm-mega-menu__container {
    display: flex;
    gap: 20px;
    min-height: 300px;
    position: relative;
}

.psm-mega-menu__left {
    flex: 0 0 30%;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

/* When header exists, adjust border radius */
.psm-mega-menu__header + .psm-mega-menu__container .psm-mega-menu__left {
    border-radius: 0 0 0 8px;
}

.psm-mega-menu__header + .psm-mega-menu__container .psm-mega-menu__right {
    border-radius: 0 0 8px 0;
}

.psm-mega-menu__right {
    flex: 0 0 70%;
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* ========================================
   Taxonomy List (Left Column)
   ======================================== */

.psm-mega-menu__taxonomy-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.psm-mega-menu__taxonomy-item {
    position: relative;
    padding: 15px 20px;
    margin: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.psm-mega-menu__taxonomy-item:last-child {
    border-bottom: none;
}

.psm-mega-menu__taxonomy-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.psm-mega-menu__taxonomy-item.active {
    background: #007bff;
    color: #ffffff;
}

.psm-mega-menu__taxonomy-item.active .psm-mega-menu__taxonomy-icon {
    color: #ffffff;
}

.psm-mega-menu__taxonomy-icon {
    font-size: 16px;
    margin-right: 10px;
    color: #666;
    transition: color 0.3s ease;
    flex-shrink: 0;
}

.psm-mega-menu__taxonomy-label {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
}

.psm-mega-menu__taxonomy-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* ========================================
   Terms Display (Right Column)
   ======================================== */

.psm-mega-menu__terms-wrapper {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.psm-mega-menu__terms-wrapper.active {
    display: block;
    opacity: 1;
}

/* Grid Layout */
.psm-mega-menu__terms-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* List Layout */
.psm-mega-menu__terms-list {
    display: flex;
    flex-direction: column;
}

.psm-mega-menu__terms-list .psm-mega-menu__term-item {
    margin-bottom: 10px;
}

.psm-mega-menu__terms-list .psm-mega-menu__term-item:last-child {
    margin-bottom: 0;
}

/* ========================================
   Term Items
   ======================================== */

.psm-mega-menu__term-item {
    position: relative;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.psm-mega-menu__term-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.psm-mega-menu__term-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.psm-mega-menu__term-link:hover {
    color: #007bff;
}

.psm-mega-menu__term-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.psm-mega-menu__term-name {
    font-size: 14px;
    font-weight: 400;
    flex: 1;
}

.psm-mega-menu__term-count {
    font-size: 12px;
    color: #999;
    margin-left: 5px;
}

/* ========================================
   View All Link
   ======================================== */

.psm-mega-menu__view-all {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    border: 2px solid #007bff;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.psm-mega-menu__view-all:hover {
    background: #007bff;
    color: #ffffff;
    transform: translateX(5px);
}

/* ========================================
   Custom Content
   ======================================== */

.psm-mega-menu__custom-content {
    padding: 10px 0;
}

.psm-mega-menu__custom-content p {
    margin-bottom: 15px;
}

.psm-mega-menu__custom-content p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Empty State
   ======================================== */

.psm-mega-menu__empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* ========================================
   Animations
   ======================================== */

/* Fade Animation */
@keyframes psmFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes psmFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Slide Animation */
@keyframes psmSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes psmSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Scale Animation */
@keyframes psmScaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes psmScaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .psm-mega-menu__left {
        flex: 0 0 35%;
    }
    
    .psm-mega-menu__right {
        flex: 0 0 65%;
    }
    
    .psm-mega-menu__terms-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .psm-mega-menu__container {
        flex-direction: column;
        gap: 0;
    }
    
    .psm-mega-menu__left,
    .psm-mega-menu__right {
        flex: 0 0 100%;
        width: 100%;
    }
    
    .psm-mega-menu__left {
        background: transparent;
        border-radius: 0;
        padding: 0;
    }
    
    .psm-mega-menu__right {
        padding: 0;
        background: transparent;
    }
    
    /* Mobile Accordion Style */
    .psm-mega-menu--mobile .psm-mega-menu__taxonomy-item {
        background: #f8f9fa;
        border-radius: 8px;
        margin-bottom: 10px;
        border: none;
    }
    
    .psm-mega-menu--mobile .psm-mega-menu__taxonomy-item.active {
        border-radius: 8px 8px 0 0;
        margin-bottom: 0;
    }
    
    .psm-mega-menu--mobile .psm-mega-menu__taxonomy-item::after {
        content: '\f078';
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        margin-left: auto;
        transition: transform 0.3s ease;
    }
    
    .psm-mega-menu--mobile .psm-mega-menu__taxonomy-item.active::after {
        transform: rotate(180deg);
    }
    
    .psm-mega-menu--mobile .psm-mega-menu__terms-wrapper {
        background: #ffffff;
        border-radius: 0 0 8px 8px;
        padding: 15px;
        margin-bottom: 10px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .psm-mega-menu__terms-grid {
        grid-template-columns: 1fr;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .psm-mega-menu__taxonomy-item {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .psm-mega-menu__term-item {
        padding: 8px 12px;
    }
    
    .psm-mega-menu__term-name {
        font-size: 13px;
    }
    
    .psm-mega-menu__term-count {
        font-size: 11px;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .psm-mega-menu {
        display: none;
    }
}

/* ========================================
   Accessibility
   ======================================== */

.psm-mega-menu__taxonomy-item:focus,
.psm-mega-menu__term-link:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .psm-mega-menu__taxonomy-item,
    .psm-mega-menu__term-item,
    .psm-mega-menu__terms-wrapper,
    .psm-mega-menu__term-link,
    .psm-mega-menu__view-all {
        transition: none;
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .psm-mega-menu__taxonomy-item {
        border: 2px solid currentColor;
    }
    
    .psm-mega-menu__term-item {
        border: 1px solid currentColor;
    }
}
