/* ================================================
   Modern Categories Mega Menu - Kullanıcı Dostu Tasarım
   ================================================ */

/* Ana Container */
.modern-categories {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 1000;
}

/* Specific override for hidden spans in categories */
.modern-categories span {
    display: inline-block !important;
    /* Force icons and labels to show */
}

@media screen and (max-width: 1400px) {

    /* Prevent parent theme from hiding our category spans and labels */
    .stm_lms_categories.modern-categories span,
    .stm_lms_categories.modern-categories .modern-categories__label,
    .stm_lms_categories.modern-categories .modern-category-parent__name,
    .stm_lms_categories.modern-categories .modern-category-child__name {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: #4e4d4d !important;
        /* Force readable color */
    }
}

/* Trigger Button */
.modern-categories__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #ffffff;
    color: #4e4d4d;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    outline: none;
    position: relative;
    overflow: hidden;
}

.modern-categories__trigger::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(231, 146, 26, 0.03) 0%, rgba(231, 146, 26, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-categories__trigger:hover {
    background: #fafafa;
    color: #e7921a;
    border-color: #e7921a;
    box-shadow: 0 2px 6px rgba(231, 146, 26, 0.15);
}

.modern-categories__trigger:hover::before {
    opacity: 1;
}

.modern-categories__trigger:active {
    transform: scale(0.98);
}

.modern-categories[data-dropdown-state="open"] .modern-categories__trigger {
    background: #fef7f0;
    color: #e7921a;
    border-color: #e7921a;
    box-shadow: 0 2px 8px rgba(231, 146, 26, 0.2);
}

.modern-categories__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #e7921a;
}

.modern-categories__icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 2;
}

.modern-categories__label {
    font-family: inherit;
    letter-spacing: 0.2px;
}

.modern-categories__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    color: #999999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-categories__trigger:hover .modern-categories__arrow {
    color: #e7921a;
}

.modern-categories[data-dropdown-state="open"] .modern-categories__arrow {
    transform: rotate(180deg);
    color: #e7921a;
}

/* Dropdown Container */
.modern-categories__dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: max-content;
    min-width: 800px;
    max-width: 1000px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
}

.modern-categories[data-dropdown-state="open"] .modern-categories__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Dropdown Arrow Indicator */
.modern-categories__dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 30px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: -3px -3px 8px rgba(0, 0, 0, 0.05);
}

.modern-categories__wrapper {
    position: relative;
    z-index: 1;
    padding: 24px;
}

/* Grid Layout */
.modern-categories__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    max-height: 500px;
    overflow-y: auto;
    padding: 8px;
}

/* Custom Scrollbar */
.modern-categories__grid::-webkit-scrollbar {
    width: 6px;
}

.modern-categories__grid::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 10px;
}

.modern-categories__grid::-webkit-scrollbar-thumb {
    background: #e7921a;
    border-radius: 10px;
}

.modern-categories__grid::-webkit-scrollbar-thumb:hover {
    background: #e52a20;
}

/* Category Column */
.modern-category-column {
    display: flex;
    flex-direction: column;
}

.modern-category-parent {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Parent Link */
.modern-category-parent__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    text-decoration: none;
    color: #4e4d4d;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.modern-category-parent__link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #e7921a;
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-category-parent__link:hover {
    background: #ffffff;
    color: #e52a20;
    border-color: #e7921a;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(231, 146, 26, 0.15);
}

.modern-category-parent__link:hover::before {
    transform: scaleY(1);
}

.modern-category-parent__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(231, 146, 26, 0.08);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.modern-category-parent__link:hover .modern-category-parent__icon {
    background: rgba(231, 146, 26, 0.15);
    color: #e52a20;
    transform: rotate(8deg) scale(1.05);
}

.modern-category-parent__icon svg {
    width: 18px;
    height: 18px;
}

.modern-category-parent__name {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

/* View All Link */
.modern-category-view-all {
    background: #fef7f0 !important;
    color: #e7921a !important;
    border: 2px dashed #e7921a !important;
}

.modern-category-view-all:hover {
    background: #e7921a !important;
    color: #ffffff !important;
    border-style: solid !important;
    border-color: #e7921a !important;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(231, 146, 26, 0.25);
}

/* Children Container */
.modern-category-children {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
    padding-left: 8px;
}

/* Child Link */
.modern-category-child {
    position: relative;
}

.modern-category-child__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    text-decoration: none;
    color: #666666;
    font-size: 13px;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
    text-transform: none !important;
}

.modern-category-child__link:hover {
    background: #fef7f0;
    color: #e52a20;
    padding-left: 16px;
}

.modern-category-child__bullet {
    color: #e7921a;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.modern-category-child__link:hover .modern-category-child__bullet {
    transform: scale(1.3);
    color: #e52a20;
    opacity: 1;
}

.modern-category-child__name {
    flex: 1;
}

.modern-category-child__count {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    opacity: 0;
    transform: translateX(-5px);
    transition: all 0.2s ease;
}

.modern-category-child__link:hover .modern-category-child__count {
    opacity: 1;
    transform: translateX(0);
}

.modern-category-child__count svg {
    width: 12px;
    height: 12px;
}

/* Nested Categories */
.modern-category-child.has-nested {
    position: relative;
}

.modern-category-nested {
    display: none;
    flex-direction: column;
    gap: 2px;
    margin-left: 20px;
    margin-top: 4px;
    padding: 8px;
    background: #fafafa;
    border-left: 2px solid #e7921a;
    border-radius: 4px;
}

.modern-category-child.has-nested:hover .modern-category-nested {
    display: flex;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .modern-categories__dropdown {
        min-width: 600px;
        max-width: 700px;
    }

    .modern-categories__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== MOBİL İYİLEŞTİRMELER ========== */
@media screen and (max-width: 768px) {

    /* Trigger button mobilde daha iyi görünsün */
    .modern-categories__trigger {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
        /* Touch friendly */
    }

    /* Dropdown tam genişlik olsun */
    .modern-categories__dropdown {
        left: 0;
        right: 0;
        transform: translateY(-10px) scale(0.95);
        min-width: 100%;
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: 0 0 16px 16px;
    }

    .modern-categories[data-dropdown-state="open"] .modern-categories__dropdown {
        transform: translateY(0) scale(1);
    }

    /* Arrow indicator mobilde gerek yok */
    .modern-categories__dropdown::before {
        display: none;
    }

    /* Wrapper padding ayarı */
    .modern-categories__wrapper {
        padding: 20px 16px;
    }

    /* Grid tek kolon */
    .modern-categories__grid {
        grid-template-columns: 1fr;
        max-height: calc(100vh - 200px);
        gap: 14px;
        padding: 4px;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    /* Kategori kartları mobilde daha büyük */
    .modern-category-parent__link {
        padding: 15px 16px;
        font-size: 15px;
        gap: 12px;
        min-height: 56px;
        align-items: center;
    }

    .modern-category-parent__icon {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
    }

    .modern-category-parent__icon svg {
        width: 20px;
        height: 20px;
    }

    .modern-category-parent__name {
        font-size: 15px;
        line-height: 1.3;
    }

    /* Alt kategoriler mobilde daha iyi görünsün */
    .modern-category-children {
        gap: 6px;
        margin-top: 10px;
        padding-left: 14px;
    }

    .modern-category-child__link {
        padding: 11px 14px;
        font-size: 14px;
        min-height: 42px;
    }

    .modern-category-child__link:hover {
        padding-left: 18px;
    }

    .modern-category-child__name {
        line-height: 1.4;
    }

    /* View all button */
    .modern-category-view-all {
        min-height: 56px;
    }
}

/* Küçük mobil cihazlar için */
@media screen and (max-width: 480px) {
    .modern-categories {
        width: 100%;
    }

    .modern-categories__trigger {
        padding: 10px 14px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
        min-height: 42px;
    }

    .modern-categories__icon {
        width: 18px;
        height: 18px;
    }

    /* Label'ı mobilde göster */
    .modern-categories__label {
        display: block;
    }

    .modern-categories__dropdown {
        top: calc(100% + 5px);
        border-radius: 0 0 14px 14px;
    }

    .modern-categories__wrapper {
        padding: 16px 12px;
    }

    .modern-categories__grid {
        gap: 12px;
        padding: 2px;
        max-height: calc(100vh - 180px);
    }

    .modern-category-parent__link {
        padding: 14px 14px;
        font-size: 14px;
        gap: 10px;
        min-height: 52px;
    }

    .modern-category-parent__icon {
        width: 34px;
        height: 34px;
    }

    .modern-category-parent__icon svg {
        width: 18px;
        height: 18px;
    }

    .modern-category-parent__name {
        font-size: 14px;
    }

    .modern-category-children {
        padding-left: 10px;
        gap: 5px;
        margin-top: 8px;
    }

    .modern-category-child__link {
        font-size: 13px;
        padding: 10px 12px;
        min-height: 40px;
    }

    .modern-category-child__bullet {
        font-size: 12px;
    }

    /* View all button mobilde daha belirgin */
    .modern-category-view-all {
        padding: 14px 16px !important;
        font-size: 14px !important;
        text-align: center;
        font-weight: 600 !important;
        min-height: 52px;
    }

    /* Scrollbar mobilde ince */
    .modern-categories__grid::-webkit-scrollbar {
        width: 4px;
    }
}

/* Çok küçük ekranlar için (iPhone SE gibi) */
@media screen and (max-width: 375px) {
    .modern-categories__trigger {
        padding: 9px 12px;
        font-size: 13px;
        gap: 6px;
    }

    .modern-categories__wrapper {
        padding: 14px 10px;
    }

    .modern-categories__grid {
        gap: 10px;
    }

    .modern-category-parent__link {
        padding: 12px 12px;
        gap: 8px;
    }

    .modern-category-parent__icon {
        width: 32px;
        height: 32px;
    }

    .modern-category-children {
        padding-left: 8px;
    }
}

/* Tablet Visibility Overrides (769px to 1025px) */
@media screen and (max-width: 1025px) and (min-width: 769px) {

    /* Force display the center unit which contains categories and search */
    .header_2 .header_top .center-unit {
        display: flex !important;
        flex: 1;
        padding: 0 15px !important;
        order: 2;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .header_2 .header_top {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 15px;
        align-items: center;
        justify-content: space-between;
    }

    .header_2 .logo-unit {
        order: 1;
        flex-shrink: 0;
        display: block !important;
    }

    .header_2 .center-unit .stm_courses_search {
        display: flex !important;
        align-items: center;
        width: 100%;
        gap: 10px;
    }

    /* Adjust search input width for tablets */
    .header_2 .header_top .stm_courses_search .stm_lms_courses_search {
        max-width: 280px;
        flex: 1;
    }

    .header_2 .header_top .right-unit {
        display: flex !important;
        order: 3;
        flex-shrink: 0;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Hide the mobile-specific search/user togglers while in tablet view */
    .header_2 .stm_header_top_search,
    .header_2 .stm_header_top_toggler {
        display: none !important;
    }

    /* Tablet Dropdown Adjustment */
    .modern-categories__dropdown {
        left: 50% !important;
        transform: translateX(-50%) translateY(-10px) scale(0.95) !important;
        min-width: 90vw !important;
        max-width: 95vw !important;
        width: max-content !important;
        position: absolute !important;
        right: auto !important;
    }

    .modern-categories[data-dropdown-state="open"] .modern-categories__dropdown {
        transform: translateX(-50%) translateY(0) scale(1) !important;
    }

    .modern-categories__dropdown::before {
        left: 50% !important;
        transform: translateX(-50%) rotate(45deg) !important;
    }
}

/* Animation Classes */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modern-category-column {
    animation: slideInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modern-category-column:nth-child(1) {
    animation-delay: 0.05s;
}

.modern-category-column:nth-child(2) {
    animation-delay: 0.1s;
}

.modern-category-column:nth-child(3) {
    animation-delay: 0.15s;
}

.modern-category-column:nth-child(4) {
    animation-delay: 0.2s;
}

.modern-category-column:nth-child(5) {
    animation-delay: 0.25s;
}

/* Accessibility */
.modern-categories__trigger:focus-visible {
    outline: 3px solid rgba(231, 146, 26, 0.5);
    outline-offset: 2px;
}

.modern-category-parent__link:focus-visible,
.modern-category-child__link:focus-visible {
    outline: 2px solid #e7921a;
    outline-offset: 2px;
}

.header_2 .header_top .stm_lms_categories.modern-categories span {
    color: inherit !important;
    font-weight: 600;
}

/* Print Styles */
@media print {
    .modern-categories {
        display: none;
    }
}


.stm_lms_search_popup .inner .header_top .stm_lms_categories_dropdown__parent a,
.stm_lms_search_popup .inner .header_top .stm_lms_categories_dropdown__parent {
    text-transform: none !important;
}

/* ========== GLOBAL BLUE TO ORANGE OVERRIDES ========== */

/* Specific overrides for the Category Dropdown mentioned in the request */
.masterstudy-theme #wrapper .stm_lms_categories_dropdown__parents .sbc_h:hover {
    color: #e7921a !important;
}

@media (max-width: 1025px) {
    .masterstudy-theme #wrapper .stm_lms_categories_dropdown__parents .sbc_h:hover {
        color: #e7921a !important;
    }
}

.ms_mobile_menu .stm_lms_categories .stm_lms_categories_dropdown__parents .stm_lms_categories_dropdown__parent .stm_lms_categories_dropdown__childs .stm_lms_categories_dropdown__childs_container .stm_lms_categories_dropdown__child a:hover,
.ms_mobile_menu .stm_lms_categories .stm_lms_categories_dropdown__parents .stm_lms_categories_dropdown__parent a:hover,
.ms_mobile_menu .stm_lms_categories .stm_lms_categories_dropdown__parents .stm_lms_categories_dropdown__parent .sbc_h:hover {
    color: #e7921a !important;
}

/* General overrides for common blue colors (#2985f7 and #385bce) */
body.masterstudy-theme .stm_lms_log_in,
body.masterstudy-theme .stm_lms_log_in i.stmlms-user,
body.masterstudy-theme .stm_lms_log_in:hover,
.header_top .right-unit .not-logged-in .lnr-heart {
    color: #e7921a !important;
}

.header_top .right-unit .btn,
.header_top .right-unit .btn:hover {
    background-color: #e7921a !important;
}

.file-wrap:hover .file-browse,
.file-wrap i.stmlms-times:hover {
    background-color: #e7921a !important;
    color: #fff !important;
}

/* Overriding #385bce (Primary Blue) in common areas */
.masterstudy-theme .header_2 .stm_lms_account_dropdown .dropdown button,
.masterstudy-theme .stm_header_links i.secondary_color,
.masterstudy-theme a.stm_lms_courses_search__button.sbc,
.masterstudy-theme #stm_lms_add_review a.btn.btn-default,
.masterstudy-theme .stm_lms_courses_wrapper .stm_lms_load_more_courses,
.masterstudy-theme .stm-lms-wrapper .masterstudy_preview_certificate,
.masterstudy-theme .stm-lms-wrapper .create-announcement-btn,
.masterstudy-theme #wrapper .header_2 .header_top .stm_courses_search .stm_lms_courses_search__button {
    border-color: #e7921a !important;
}

.masterstudy-theme #wrapper .stm_lms_categories_dropdown__child a:hover,
.stm_header_links a.stm_lms_bi_link.normal_font:hover,
.stm_header_links i.lnr.lnr-bullhorn.secondary_color,
.stm_header_links i.stmlms-case.secondary_color,
.message-notice a {
    color: #e7921a !important;
}

/* Mobilde Menü İçindeki Linkler */
.stm_header_links_mobile {
    padding: 20px 0;
    margin-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stm_header_links_mobile .stm_lms_bi_link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    padding: 12px 16px;
    background: #fafafa;
    border-radius: 8px;
    color: #4e4d4d !important;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.stm_header_links_mobile .stm_lms_bi_link:hover {
    background: #fef7f0;
    color: #e7921a !important;
    transform: translateX(5px);
}

.stm_header_links_mobile .stm_lms_bi_link i {
    font-size: 18px;
    color: #e7921a !important;
}

.stm_header_links_mobile .masterstudy-become-instructor-modal-parent,
.stm_header_links_mobile .masterstudy-enterprise-modal-parent {
    display: block;
    width: 100%;
}