/**
 * Premium Mobile Modernization Styles for WooCommerce My Account (Categorized Mega Menu)
 */

/* ==========================================================================
   Global Desktop Tweaks (No mobile overrides)
   ========================================================================== */
.modern-mobile-menu-wrapper {
    display: none; /* Hide on desktop by default */
}

/* ==========================================================================
   Mobile Adjustments (under 768px)
   ========================================================================== */
@media (max-width: 767px) {
    /* Main Layout Stack */
    .woocommerce-account .woocommerce {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* 1. Hide Standard WooCommerce Menu */
    .woocommerce-MyAccount-navigation {
        display: none !important;
    }

    /* 2. Modern Mega Menu Wrapper */
    .modern-mobile-menu-wrapper {
        display: block;
        position: relative;
        width: 100%;
        margin-bottom: 15px;
    }

    /* 3. Mega Menu Toggle Bar */
    .modern-mobile-menu-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 20px;
        background: #ffffff;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 16px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        user-select: none;
    }

    .modern-mobile-menu-toggle:hover {
        border-color: rgba(0, 0, 0, 0.15);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    }

    .active-item-text {
        font-weight: 700;
        font-size: 15px;
        color: #111111;
        position: relative;
        padding-right: 28px;
    }

    /* Adding an active bullet indicator before the active page text */
    .active-item-text::before {
        content: "";
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 8px;
        height: 8px;
        background: #0073aa;
        border-radius: 50%;
        box-shadow: 0 0 8px rgba(0, 115, 170, 0.6);
    }

    .toggle-icon {
        font-size: 16px;
        font-weight: bold;
        color: #666;
        transition: transform 0.3s ease;
    }

    /* 4. Categorized Mega Menu Dropdown Box */
    .modern-mobile-mega-menu {
        display: none; /* Controlled by JS toggle classes */
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 20px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
        z-index: 9999;
        padding: 20px;
        box-sizing: border-box;
        transform-origin: top center;
        animation: slideDownMenu 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    /* Show dropdown panel when open */
    .modern-mobile-menu-wrapper.is-open .modern-mobile-mega-menu {
        display: block;
    }

    @keyframes slideDownMenu {
        from {
            opacity: 0;
            transform: scaleY(0.95);
        }
        to {
            opacity: 1;
            transform: scaleY(1);
        }
    }

    /* 5. Category Organization inside Mega Menu */
    .mega-menu-category {
        margin-bottom: 20px;
    }

    .mega-menu-category:last-child {
        margin-bottom: 0;
    }

    .category-title {
        font-size: 13px !important;
        font-weight: 800 !important;
        text-transform: uppercase;
        color: #8e8e93 !important;
        margin: 0 0 10px 0 !important;
        padding-bottom: 6px !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        letter-spacing: 0.5px;
    }

    /* 2-Column Grid Layout for Items */
    .category-links-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* Grid Items / Links */
    .category-links-grid > div {
        display: block;
    }

    .category-links-grid > div a {
        display: block !important;
        padding: 12px 14px !important;
        background: #f8f9fa !important;
        color: #333333 !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        border-radius: 12px !important;
        transition: all 0.2s ease !important;
        border: 1px solid rgba(0,0,0,0.02) !important;
        text-align: center !important;
    }

    .category-links-grid > div a:hover,
    .category-links-grid > div a:active {
        background: #e9ecef !important;
        color: #000000 !important;
    }

    /* Active Link Styling inside Grid */
    .category-links-grid > div.is-active a,
    .category-links-grid > div.active a {
        background: linear-gradient(135deg, #111, #333) !important;
        color: #ffffff !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
        border-color: transparent !important;
    }

    /* 6. Content Container Styling */
    .woocommerce-MyAccount-content {
        width: 100% !important;
        float: none !important;
        padding: 10px 0 !important;
    }

    /* Dashboard Welcome Banner */
    .woocommerce-MyAccount-content > p:first-of-type {
        background: linear-gradient(135deg, #f8f9fa, #e9ecef);
        border-radius: 16px;
        padding: 20px;
        font-size: 15px;
        line-height: 1.6;
        color: #333;
        box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
        margin-bottom: 25px;
        position: relative;
        border-left: 5px solid #222;
    }

    /* 7. Table Modernization (Responsive Cards) */
    .woocommerce-orders-table,
    .woocommerce-MyAccount-downloads,
    .woocommerce-table--order-details {
        border: none !important;
        background: transparent !important;
        display: block !important;
        width: 100% !important;
    }

    .woocommerce-orders-table thead,
    .woocommerce-MyAccount-downloads thead,
    .woocommerce-table--order-details thead {
        display: none !important;
    }

    .woocommerce-orders-table tbody,
    .woocommerce-MyAccount-downloads tbody,
    .woocommerce-table--order-details tbody {
        display: block !important;
        width: 100% !important;
    }

    /* Table Rows as Cards */
    .woocommerce-orders-table tr,
    .woocommerce-MyAccount-downloads tr,
    .woocommerce-table--order-details tr {
        display: block !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        border-radius: 16px !important;
        padding: 16px !important;
        margin-bottom: 16px !important;
        background: #ffffff !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
        position: relative;
    }

    /* Table Cells as Rows in Cards */
    .woocommerce-orders-table td,
    .woocommerce-MyAccount-downloads td,
    .woocommerce-table--order-details td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 0 !important;
        border: none !important;
        border-bottom: 1px dashed rgba(0, 0, 0, 0.06) !important;
        font-size: 14px !important;
        text-align: right !important;
    }

    .woocommerce-orders-table td:last-child,
    .woocommerce-MyAccount-downloads td:last-child,
    .woocommerce-table--order-details td:last-child {
        border-bottom: none !important;
    }

    /* Inject Data Label on the Left */
    .woocommerce-orders-table td::before,
    .woocommerce-MyAccount-downloads td::before,
    .woocommerce-table--order-details td::before {
        content: attr(data-title) ": ";
        font-weight: 700;
        color: #111;
        text-align: left;
        margin-left: 10px;
    }

    /* Actions Column specific styling */
    .woocommerce-orders-table td.woocommerce-orders-table__cell-order-actions,
    .woocommerce-MyAccount-downloads td.download-file {
        justify-content: center !important;
        padding-top: 15px !important;
        border-bottom: none !important;
    }

    .woocommerce-orders-table td.woocommerce-orders-table__cell-order-actions a.button,
    .woocommerce-MyAccount-downloads td.download-file a.button {
        display: inline-block !important;
        width: 100% !important;
        text-align: center !important;
        padding: 12px !important;
        border-radius: 12px !important;
        background: #111 !important;
        color: #fff !important;
        font-weight: bold !important;
        border: none !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
    }

    /* Addresses Cards Styling */
    .woocommerce-Addresses {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    .woocommerce-Address {
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        border-radius: 16px !important;
        padding: 20px !important;
        background: #fff !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
    }

    .woocommerce-Address-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        padding-bottom: 8px;
    }

    .woocommerce-Address-title h3 {
        margin: 0 !important;
        font-size: 18px !important;
    }
}
