/**
 * DS Kerempuh Arhiva - Frontend Styles
 * Version: 1.0.0
 */

/* Wrapper */
.ds-arhiva-wrapper {
    width: 100%;
    position: relative;
    padding-bottom: 40px;
}

/* Filters */
.ds-arhiva-filters {
    display: flex;
    gap: 64px;
    margin-bottom: 5vh;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 15px;
}

.filter-item {
    position: relative;
}

.filter-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: none;
    cursor: pointer;
    background: transparent;
    min-width: auto;
    transition: all 0.3s ease;
}

.filter-dropdown.active .filter-arrow {
    transform: rotate(180deg);
}

.filter-label {
    font-size: 20px;
    font-weight: 400;
    color: #000;
    transition: opacity 0.3s ease;
}

.filter-arrow {
    width: 15px;
    height: 15px;
    transition: transform 0.3s ease;
    background: url('../images/arhiva-arrow-down.svg') no-repeat center;
    background-size: contain;
    margin-top: 5px;
}

.filter-dropdown.active .filter-arrow {
    transform: rotate(180deg);
}

.filter-dropdown-content {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e0e0e0;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.filter-dropdown.active .filter-dropdown-content {
    display: block;
}

.filter-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    user-select: none;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.3;
}

.filter-option:last-child {
    border-bottom: none;
}

.filter-option:hover {
    background: #f8f8f8;
}

.filter-option:active {
    background: #f0f0f0;
}

.filter-option.selected {
    background: #f0f0f0;
    font-weight: 600;
}

/* Search filter */
.filter-search {
    position: relative;
    width: 250px;
     margin-right: 20px;
     margin-top: -6px;
}

.filter-search input {
    padding: 8px 40px 8px 15px;
    border: none;
    border-bottom: 1px solid #000 !important;
    width: 100%;
    font-size: 16px;
    background: transparent !important;
    outline: none;
    box-shadow: none !important;
}

.filter-search input:focus {
    border-bottom-color: #000 !important;
}

.filter-search::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background-image: url('../images/arhiva-pretraga.png');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
}


/* Archive items */
.ds-arhiva-items {
    position: relative;
}

/* Single archive item */
.arhiva-item {
    position: relative;
    border-top: 1px solid var(--line-color, #000);
    padding-top: 40px;
    margin-bottom: 20px;
}

.arhiva-item:first-child {
    border-top: none;
    padding-top: 20px;
}

.arhiva-item.filtered-out {
    display: none;
}

/* Year header */
.arhiva-item-header {
    cursor: pointer;
    transition: transform 0.3s ease;
    transform-origin: left center;
}

.arhiva-item-header:hover {
    transform: scale(1.05);
}

.arhiva-year {
    font-family: 'Brule', sans-serif;
    font-size: var(--year-font-size-desktop, 100px);
    font-weight: 600;
    color: var(--year-color, #000);
    line-height: 1;
    margin: 0;
    padding: 20px 0;
}

/* Content (initially hidden) */
.arhiva-item-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.arhiva-item.expanded .arhiva-item-content {
    max-height: 5000px;
    padding-bottom: 40px;
    transition: max-height 0.5s ease;
}

/* Grid */
.arhiva-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns-desktop, 3), 1fr);
    gap: var(--row-gap, 30px) var(--column-gap, 30px);
    padding-top: 20px;
}

.grid-item {
    position: relative;
    color: var(--content-color, #000);
}

.grid-item.filtered-out {
    display: none;
}

/* Grid item content */
.item-author-name {
    font-size: var(--author-font-size, 14px);
    line-height: 1.2;
    margin-bottom: 8px;
}

.item-title {
    font-size: var(--title-font-size, 16px);
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.2;
    margin-bottom: 10px;
}

.item-description {
    font-size: var(--description-font-size, 14px);
    line-height: 1.5;
}

.item-description p {
    margin: 0 0 10px 0;
}

.item-description p:last-child {
    margin-bottom: 0;
}

/* Highlight matched text */
.highlight {
    background: yellow;
    font-weight: 600;
}

/* No results message */
.no-results {
    padding: 40px;
    text-align: center;
    font-size: 16px;
    color: #000;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .arhiva-year {
        font-size: var(--year-font-size-tablet, 70px);
    }

    .arhiva-grid {
        grid-template-columns: repeat(var(--columns-tablet, 2), 1fr);
    }

    .ds-arhiva-filters {
        gap: 30px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .arhiva-year {
        font-size: var(--year-font-size-mobile, 50px);
    }

    .arhiva-grid {
        grid-template-columns: 1fr;
    }

    .ds-arhiva-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        padding-bottom: 20px;
    }

    .filter-item {
        width: auto;
    }

    .filter-search {
        width: 90%;
    }

    .arhiva-item {
        padding-top: 30px;
    }

    .arhiva-item:first-child {
        padding-top: 20px;
    }
}

/* Animations */
.arhiva-item.expanded .grid-item {
    opacity: 1;
}

/* Scrollbar styling for dropdown */
.filter-dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.filter-dropdown-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.filter-dropdown-content::-webkit-scrollbar-thumb {
    background: #000;
    border-radius: 3px;
}

.filter-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #000;
}

/* Print styles */
@media print {
    .ds-arhiva-filters {
        display: none;
    }

    .arhiva-item {
        border-top: 1px solid #000;
        page-break-inside: avoid;
    }

    .arhiva-item-content {
        max-height: none !important;
    }
}