/**
 * Modern Elementor Links Widget Stylesheet
 * 
 * Provides clean, modern glassmorphic look with automated dark/light mode detection
 * based on theme classes, and scrollable support on mobile screens.
 */

.modern-links-widget {
    margin: 2rem 0 1.5rem 0 !important;
    width: 100% !important;
    clear: both !important; /* Prevents alignment issues caused by floated elements above */
}

.modern-links-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    margin-top: 0 !important;
    margin-bottom: 1.25rem !important;
    color: currentColor !important; /* Inherits the current font color of the container */
    font-family: inherit !important;
    line-height: 1.2 !important;
    display: block !important;
}

.modern-links-list {
    display: flex !important;
    gap: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
    align-items: center !important; /* Perfect vertical alignment */
    width: 100% !important;
}

/* 
 * Clearfix Reset: Prevents pseudo-elements injected by themes/bootstrap 
 * from acting as flex items and shifting the alignment of the first/last button.
 */
.modern-links-list::before,
.modern-links-list::after {
    display: none !important;
    content: none !important;
}

/* Desktop wrapping for links */
@media (min-width: 768px) {
    .modern-links-list {
        flex-wrap: wrap !important;
    }
}

/* Mobile horizontal scrolling with touch-swipe, keeping UI clean without horizontal scrollbar */
@media (max-width: 767px) {
    .modern-links-list {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important; /* Firefox */
        -ms-overflow-style: none !important; /* IE/Edge */
        padding-bottom: 8px !important; /* space to prevent box-shadow clipping */
        margin-bottom: -8px !important;
    }
    .modern-links-list::-webkit-scrollbar {
        display: none !important; /* Chrome, Safari, Opera */
    }
}

.modern-links-item {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important; /* Resets theme list margins */
    padding: 0 !important; /* Resets theme list paddings */
    list-style: none !important;
    border: none !important;
}

/* Pseudo-element Reset: Prevents themes from forcing bullet symbols/icons on list items */
.modern-links-item::before,
.modern-links-item::after {
    display: none !important;
    content: none !important;
}

.modern-links-anchor {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 20px !important;
    border-radius: 100px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
    line-height: 1 !important; /* Prevents vertical shifting of text */
    vertical-align: middle !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    
    /* Default Light Mode Colors: Clean high-contrast colors for visibility */
    background-color: #f3f4f6 !important; /* Solid light grey background */
    border: 1px solid #e5e7eb !important;    /* Light grey border */
    color: #1f2937 !important;               /* Dark text */
}

.modern-links-anchor:hover {
    background-color: #111827 !important;    /* Dark background on hover */
    border-color: #111827 !important;
    color: #ffffff !important;               /* White text on hover */
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

/* 
 * Dark Mode Detection:
 * Matches any active dark mode theme classes on body/html tags (including Atlas native skins)
 */
body.dark .modern-links-anchor,
body.dark-mode .modern-links-anchor,
body.dark-skin .modern-links-anchor,
body.skin-dark .modern-links-anchor,
body.is-dark .modern-links-anchor,
body.night .modern-links-anchor,
body.night-mode .modern-links-anchor,
body.dark-theme .modern-links-anchor,
body[data-theme="dark"] .modern-links-anchor,
body[data-theme="night"] .modern-links-anchor,
body[data-mode="dark"] .modern-links-anchor,
html.dark .modern-links-anchor,
html.dark-mode .modern-links-anchor,
html.night .modern-links-anchor,
html.night-mode .modern-links-anchor,
html[data-theme="dark"] .modern-links-anchor,
.dark .modern-links-anchor,
.dark-mode .modern-links-anchor,
.dark-skin .modern-links-anchor,
.skin-dark .modern-links-anchor,
.night .modern-links-anchor,
.night-mode .modern-links-anchor,
[data-theme="dark"] .modern-links-anchor {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #f3f4f6 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

body.dark .modern-links-anchor:hover,
body.dark-mode .modern-links-anchor:hover,
body.dark-skin .modern-links-anchor:hover,
body.skin-dark .modern-links-anchor:hover,
body.is-dark .modern-links-anchor:hover,
body.night .modern-links-anchor:hover,
body.night-mode .modern-links-anchor:hover,
body.dark-theme .modern-links-anchor:hover,
body[data-theme="dark"] .modern-links-anchor:hover,
body[data-theme="night"] .modern-links-anchor:hover,
body[data-mode="dark"] .modern-links-anchor:hover,
html.dark .modern-links-anchor:hover,
html.dark-mode .modern-links-anchor:hover,
html.night .modern-links-anchor:hover,
html.night-mode .modern-links-anchor:hover,
html[data-theme="dark"] .modern-links-anchor:hover,
.dark .modern-links-anchor:hover,
.dark-mode .modern-links-anchor:hover,
.dark-skin .modern-links-anchor:hover,
.skin-dark .modern-links-anchor:hover,
.night .modern-links-anchor:hover,
.night-mode .modern-links-anchor:hover,
[data-theme="dark"] .modern-links-anchor:hover {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
    color: #111827 !important;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.25) !important;
}
