/* Base block styling */
.wp-block-tender-notices {
    position: relative;
    overflow: visible;
    padding: 0;
    background: transparent !important;
    border: 0 !important;
}

.wp-block-hoyry-itsfinland-tender-notices-block {
    background: transparent !important;
    border: 0 !important;
}

/* Header section */
.tender-notices-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.tender-notices-header h2 {
    margin: 0;
    font-size: clamp(1.5rem, 2vw, 2rem);
    font-weight: 600;
    line-height: 1.2;
}

.tender-notices-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.tender-notices-meta .new-badge {
    background: #4a9eff;
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.tender-notices-meta .pagination-indicator {
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.tender-notices-meta .toggle-menu {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: none !important;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.tender-notices-meta .toggle-menu svg {
    width: 24px;
    height: 24px;
}

/* Subheader */
.tender-notices-subheader {
    margin-bottom: 2rem;
}

.tender-notices-subheader p {
    margin: 0;
    color: #666;
    font-size: 1rem;
}

/* Carousel wrapper */
.hoyry-listing-carousel {
    position: relative;
    padding-bottom: 2em;
}

/* Embla carousel container */
.wp-block-tender-notices .embla {
    --slide-spacing: clamp(0.882rem, 0.679rem + 1.154vw, 1.765rem);
    --slide-size: 100%;
    position: relative;
}

.wp-block-tender-notices .embla__viewport {
    overflow: hidden;
}

.wp-block-tender-notices .embla__container {
    display: flex;
    margin-left: 0;
    margin-top: 10px;
}

/* Responsive slides per view */
@media (min-width: 600px) {
    .wp-block-tender-notices .embla {
        --slide-size: calc(100% / 2);
    }
}

@media (min-width: 950px) {
    .wp-block-tender-notices .embla {
        --slide-size: calc(100% / 3);
    }
}

@media (min-width: 1400px) {
    .wp-block-tender-notices .embla {
        --slide-size: calc(100% / 4);
    }
}

.wp-block-tender-notices .embla__slide {
    flex: 0 0 100%;
    min-width: 100%;
    box-sizing: border-box;
    padding: 0 10px;
}

/* Grid inside each page/slide */
.wp-block-tender-notices .tender-items-grid {
    display: flex;
    flex-wrap: wrap;
    margin-left: calc(var(--slide-spacing) * -1);
}

.wp-block-tender-notices .tender-item-wrapper {
    flex: 0 0 calc(var(--slide-size) - var(--slide-spacing));
    padding-left: var(--slide-spacing);
    display: flex;
    align-items: flex-start;
}

/* Tender item card */
.wp-block-tender-notices .tender-item {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #2d2d2d;
    color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    position: relative;
}

.wp-block-tender-notices .tender-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    background: #353535;
}

/* Tender header with flag and days */
.wp-block-tender-notices .tender-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.wp-block-tender-notices .flag {
    font-size: 1.75rem;
    line-height: 1;
}

.wp-block-tender-notices .days-left {
    background: #4caf50;
    color: #fff;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    margin-left: auto;
}

.wp-block-tender-notices .days-expired {
    background: #f44336;
    color: #fff;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    margin-left: auto;
}

/* Title */
.wp-block-tender-notices .tender-item .title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    flex-grow: 1;
}

/* Category */
.wp-block-tender-notices .category {
    color: #999;
    font-size: 0.875rem;
    margin-top: auto;
}

/* Deadline */
.wp-block-tender-notices .deadline {
    color: #999;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* CTA */
.wp-block-tender-notices .cta {
    color: #4a9eff;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.wp-block-tender-notices .tender-item:hover .cta {
    text-decoration: underline;
}

/* Flag icon support (e.g. WBG icon) */
.wp-block-tender-notices .flag {
    display: inline-flex;
    align-items: center;
}

.wp-block-tender-notices .flag img.flag-icon {
    width: 28px;
    height: 28px;
    display: block;
    filter: brightness(0) invert(1);
}


/* Carousel arrows - show them again */
.hoyry-listing-carousel-arrows {
    position: absolute;
    top: -4rem;
    right: 0;
    display: flex;
    gap: 0.5rem;
    z-index: 1;
}

.hoyry-listing-carousel-arrow {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.hoyry-listing-carousel-arrow:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #999;
}

.hoyry-listing-carousel-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.hoyry-listing-carousel-arrow svg {
    width: 20px;
    height: 20px;
    color: #333;
}

.hoyry-listing-carousel-arrow-prev svg {
    transform: rotate(180deg);
}

/* Carousel dots - show them again */
.hoyry-listing-carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.hoyry-listing-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: gainsboro;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}

.hoyry-listing-carousel-dot:hover {
    background: #999;
}

.hoyry-listing-carousel-dot.is-selected {
    background: #333;
    width: 12px;
    height: 12px;
}

/* Footer */
.tender-notices-footer {
    margin: 0;
    text-align: center;
}

.tender-notices-footer p {
    margin: 0;
    color: #666;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 599px) {
    .tender-notices-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .tender-notices-meta {
        width: 100%;
        justify-content: space-between;
    }
    
    .tender-notices-subheader {
        margin-bottom: 60px;
    }
    
    .hoyry-listing-carousel-arrows {
        top: -3rem;
    }
    
    .wp-block-tender-notices .tender-item {
        padding: 1.25rem;
    }
    
    .wp-block-tender-notices .tender-item .title {
        font-size: 0.9375rem;
    }
}

/* Dark mode support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .tender-notices-header h2,
    .tender-notices-subheader p {
        color: inherit;
    }
    
    .tender-notices-meta .pagination-indicator {
        color: #999;
    }
    
    .hoyry-listing-carousel-arrow {
        background: #333;
        border-color: #555;
    }
    
    .hoyry-listing-carousel-arrow svg {
        color: #fff;
    }
    
    .hoyry-listing-carousel-arrow:hover:not(:disabled) {
        background: #444;
        border-color: #666;
    }
    
    .hoyry-listing-carousel-dot {
        background: gainsboro;
    }
    
    .hoyry-listing-carousel-dot.is-selected {
        background: #555;
    }
}

/* Editor specific styles */
.editor-styles-wrapper .wp-block-tender-notices .embla__container {
    flex-wrap: wrap;
}

.editor-styles-wrapper .wp-block-tender-notices .embla__slide {
    flex: 0 0 calc(33.333% - var(--slide-spacing));
    min-width: 250px;
}

/* Full width alignment */
.wp-block-tender-notices.alignfull {
    max-width: 100%;
}

.wp-block-tender-notices.alignwide {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Accessibility */
.hoyry-listing-carousel-arrow:focus,
.hoyry-listing-carousel-dot:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.wp-block-tender-notices .tender-item:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

/* Loading state */
.wp-block-tender-notices.is-loading {
    opacity: 0.6;
    pointer-events: none;
}
