/* NewsTagWidget Frontend Styles */

.wcag-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.wcag-tags-item {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--bs-light, #f8f9fa);
    border: var(--bs-border-width, 1px) var(--bs-border-style, solid) var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.375rem);
    color: var(--bs-gray-700, #495057);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: var(--bs-box-shadow-sm, 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075));
}

.wcag-tags-item:hover {
    background-color: var(--bs-gray-100, #e9ecef);
    border-color: var(--bs-gray-400, #ced4da);
    color: var(--bs-gray-800, #343a40);
    transform: translateY(-1px);
    box-shadow: var(--bs-box-shadow, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
}

.wcag-tags-item:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem var(--bs-btn-focus-box-shadow, rgba(0, 123, 255, 0.25));
}

.wcag-tags-item.active,
.wcag-tags-item[aria-pressed="true"] {
    background-color: var(--bs-primary, #0d6efd);
    border-color: var(--bs-primary, #0d6efd);
    color: var(--bs-white, #ffffff);
    box-shadow: var(--bs-box-shadow, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
}

.wcag-tags-item.active:hover,
.wcag-tags-item[aria-pressed="true"]:hover {
    background-color: var(--bs-primary-dark, #0b5ed7);
    border-color: var(--bs-primary-dark, #0b5ed7);
    color: var(--bs-white, #ffffff);
}

.news-tag-widget-results {
    margin-top: 20px;
}

.news-tag-widget-results .news-item {
    margin-bottom: 15px;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.news-tag-widget-results .news-item:last-child {
    border-bottom: none;
}

.news-tag-widget-results .news-item h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.news-tag-widget-results .news-item .date {
    color: #666;
    font-size: 12px;
}

/* Plugin-specific date input styling to fix visibility issues */
.plugin-accessible-datepicker-input,
.plugin-tag-filters-form .form-control,
input[type="text"]#pluginFrom,
input[type="text"]#pluginTill {
    color: #495057 !important;
    background-color: #fff !important;
    border: 1px solid #ced4da !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.plugin-accessible-datepicker-input:focus,
.plugin-tag-filters-form .form-control:focus,
input[type="text"]#pluginFrom:focus,
input[type="text"]#pluginTill:focus {
    color: #495057 !important;
    background-color: #fff !important;
    border-color: #80bdff !important;
}

.plugin-accessible-datepicker-input::placeholder {
    color: #6c757d !important;
    opacity: 1 !important;
}

/* Fix jQuery UI Datepicker Calendar Popup Visibility */
.ui-datepicker {
    background: #ffffff !important;
    border: 1px solid #aaaaaa !important;
    color: #222222 !important;
    font-family: Arial, sans-serif !important;
    font-size: 13px !important;
    z-index: 9999 !important;
}

.ui-datepicker .ui-datepicker-header {
    background: #cccccc !important;
    border: 1px solid #aaaaaa !important;
    color: #222222 !important;
    font-weight: bold !important;
}

.ui-datepicker .ui-datepicker-title {
    color: #222222 !important;
    font-weight: bold !important;
    text-align: center !important;
}

.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
    background: #e6e6e6 !important;
    border: 1px solid #cccccc !important;
    color: #222222 !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.ui-datepicker .ui-datepicker-prev:hover,
.ui-datepicker .ui-datepicker-next:hover {
    background: #dadada !important;
    border: 1px solid #999999 !important;
    color: #212121 !important;
}

.ui-datepicker table {
    background: #ffffff !important;
    border-collapse: collapse !important;
    font-size: 13px !important;
    margin: 0 !important;
    width: 100% !important;
}

.ui-datepicker th {
    background: #dadada !important;
    border: 1px solid #cccccc !important;
    color: #222222 !important;
    font-weight: bold !important;
    padding: 5px !important;
    text-align: center !important;
}

.ui-datepicker td {
    background: #ffffff !important;
    border: 1px solid #eeeeee !important;
    padding: 1px !important;
    text-align: center !important;
}

.ui-datepicker td a {
    background: #ffffff !important;
    border: 1px solid transparent !important;
    color: #222222 !important;
    display: block !important;
    padding: 3px !important;
    text-align: center !important;
    text-decoration: none !important;
}

.ui-datepicker td a:hover {
    background: #0073aa !important;
    border: 1px solid #0073aa !important;
    color: #ffffff !important;
}

.ui-datepicker td.ui-datepicker-today a {
    background: #ffffcc !important;
    border: 1px solid #ffccaa !important;
    color: #222222 !important;
    font-weight: bold !important;
}

.ui-datepicker td.ui-datepicker-current-day a,
.ui-datepicker td.ui-state-active a {
    background: #0073aa !important;
    border: 1px solid #0073aa !important;
    color: #ffffff !important;
    font-weight: bold !important;
}

.ui-datepicker td.ui-datepicker-other-month a {
    background: #f5f5f5 !important;
    color: #999999 !important;
}

.ui-datepicker .ui-datepicker-buttonpane {
    background: #f0f0f0 !important;
    border-top: 1px solid #cccccc !important;
    text-align: left !important;
    padding: 8px !important;
}

.ui-datepicker .ui-datepicker-buttonpane button {
    background: #e6e6e6 !important;
    border: 1px solid #cccccc !important;
    color: #222222 !important;
    cursor: pointer !important;
    font-size: 11px !important;
    margin: 0.5em 0.2em 0.4em !important;
    padding: 0.2em 0.6em 0.3em 0.6em !important;
}

.ui-datepicker .ui-datepicker-buttonpane button:hover {
    background: #dadada !important;
    border: 1px solid #999999 !important;
    color: #212121 !important;
}

/* Handle Ukrainian month/day names */
.ui-datepicker .ui-datepicker-month,
.ui-datepicker .ui-datepicker-year {
    color: #222222 !important;
}

/* More Themes Dropdown Styles */
.more-themes-wrapper {
    position: relative;
    display: inline-block;
}

.more-themes-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.more-themes-arrow {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.more-themes-btn[aria-expanded="true"] .more-themes-arrow {
    transform: rotate(180deg);
}

.more-themes-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.375rem);
    box-shadow: var(--bs-box-shadow, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 5px;
    min-width: 200px;
}

.more-themes-item {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: transparent;
    color: var(--bs-gray-700, #495057);
    text-align: left;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.175));
}

.more-themes-item:last-child {
    border-bottom: none;
}

.more-themes-item:hover {
    background-color: var(--bs-gray-100, #f8f9fa);
    color: var(--bs-gray-800, #343a40);
}

.more-themes-item:focus {
    outline: 0;
    background-color: var(--bs-primary-subtle, #cfe2ff);
    color: var(--bs-primary-emphasis, #052c65);
}

.more-themes-item.active,
.more-themes-item[aria-pressed="true"] {
    background-color: var(--bs-primary, #0d6efd);
    color: var(--bs-white, #ffffff);
}

.more-themes-item .tag-count {
    color: var(--bs-gray-500, #6c757d);
    font-size: 12px;
    margin-left: 5px;
}

.more-themes-item:hover .tag-count,
.more-themes-item.active .tag-count {
    color: inherit;
    opacity: 0.8;
}

/* Hide mobile-only tags on desktop */
.mobile-only-tags {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wcag-tags {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scrollbar-width: thin;
        scrollbar-color: #ccc transparent;
        padding-bottom: 10px;
        margin-bottom: 15px;
        direction: ltr;
        gap: 8px;
    }
    
    /* Hide "Ще теми" dropdown on mobile */
    .more-themes-wrapper {
        display: none !important;
    }
    
    /* Show mobile-only tags on mobile */
    .mobile-only-tags {
        display: contents !important;
    }
    
    /* Disable ALL animations and transforms on mobile */
    .more-themes-btn,
    .more-themes-wrapper,
    .wcag-tags-item,
    .more-themes-item {
        animation: none !important;
        transform: none !important;
        transition: none !important;
        -webkit-transform: none !important;
        -webkit-transition: none !important;
        border-radius: 100px !important;
        border: 2px solid rgba(35,65,97,0.5) !important;
        overflow: visible !important;
    }
    
    .wcag-tags::-webkit-scrollbar {
        height: 6px;
    }
    
    .wcag-tags::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .wcag-tags::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }
    
    .wcag-tags::-webkit-scrollbar-thumb:hover {
        background: #999;
    }
    
    .wcag-tags-item {
        flex-shrink: 0 !important;
        white-space: nowrap;
        direction: ltr;
        padding: 6px 15px 4px 15px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        line-height: 11px !important;
        min-width: auto !important;
        max-width: fit-content;
        min-height: fit-content;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .wcag-tags.dragging {
        cursor: grabbing;
        user-select: none;
    }
    
    .wcag-tags.dragging .wcag-tags-item {
        pointer-events: none;
    }
    
    .more-themes-wrapper {
        flex-shrink: 0;
        direction: ltr;
    }
    
    .more-themes-btn {
        padding: 12px 16px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        line-height: 1.3 !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .more-themes-dropdown {
        position: fixed !important;
        left: 20px !important;
        right: 20px !important;
        top: 20% !important;
        bottom: auto !important;
        min-width: auto !important;
        max-width: none !important;
        width: calc(100vw - 40px) !important;
        z-index: 99999 !important;
        background: #ffffff !important;
        border: 3px solid #2c5aa0 !important;
        border-radius: 12px !important;
        box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important;
        max-height: 60vh !important;
        overflow-y: auto !important;
        padding: 10px !important;
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    .more-themes-wrapper {
        flex-shrink: 0;
        direction: ltr;
        position: static !important;
    }
    
    .more-themes-btn {
        padding: 12px 16px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        line-height: 1.3 !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: static !important;
        transform: none !important;
        transition: none !important;
    }
    
    .more-themes-item {
        padding: 15px 20px !important;
        font-size: 16px !important;
        border-bottom: 1px solid #eee !important;
        color: #333 !important;
        background: #fff !important;
    }
    
    .more-themes-item:hover {
        background: #f0f8ff !important;
        color: #2c5aa0 !important;
    }
    
    .more-themes-item:last-child {
        border-bottom: none !important;
    }
    
    /* Clean mobile dropdown styling */
    .more-themes-dropdown[style*="display: block"] {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        z-index: 999999 !important;
        background: #ffffff !important;
        border: 2px solid #2c5aa0 !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 30px rgba(0,0,0,0.4) !important;
        transform: none !important;
        clip: auto !important;
        overflow-y: auto !important;
    }
}

/* Accessibility improvements */
.more-themes-btn:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}

.more-themes-item:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: -2px;
}

