/* ===============================
   KOBAULT PROJECTS WIDGET STYLES
   =============================== */

/* Wrapper */
.kobault-projects-wrapper {
    width: 100%;
    margin: 0 auto;
}

/* ===============================
   FILTERS
   =============================== */
.kobault-filters-wrapper {
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.kobault-filter-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    flex: 1;
}

.kobault-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.kobault-filter-group label {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin: 0;
}

/* Filter Action Buttons (Show All / Reset) */
.kobault-filter-action {
    display: flex;
    align-items: center;
}

.kobault-filter-action-left {
    order: -1;
}

.kobault-filter-action-right {
    order: 1;
    margin-left: auto;
}

.kobault-show-all-btn,
.kobault-reset-btn {
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.kobault-show-all-btn {
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
}

.kobault-show-all-btn:hover {
    background-color: #555;
}

.kobault-reset-btn {
    background-color: transparent;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.kobault-reset-btn:hover {
    background-color: #f5f5f5;
}

/* Mobile Filter Layout */
@media (max-width: 767px) {
    .kobault-filters-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "showbtn resetbtn"
            "filters filters";
        gap: 15px;
    }

    /* Action buttons row - side by side at top */
    .kobault-filter-action-left {
        grid-area: showbtn;
    }

    .kobault-filter-action-right {
        grid-area: resetbtn;
        margin-left: 0;
    }

    .kobault-show-all-btn,
    .kobault-reset-btn {
        width: 100%;
    }

    /* Filters row - full width below buttons */
    .kobault-filter-groups {
        grid-area: filters;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    /* Filter dropdowns */
    .kobault-filter-group {
        min-width: 0;
    }
}

/* Custom Dropdown Filters */
.kobault-dropdown {
    position: relative;
    width: 100%;
}

.kobault-dropdown-selected {
    padding: 10px 15px;
    padding-right: 35px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.kobault-dropdown-selected:hover {
    border-color: #999;
}

.kobault-dropdown.open .kobault-dropdown-selected {
    border-color: #999;
}

.kobault-dropdown-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kobault-dropdown-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #666;
    transition: transform 0.3s ease;
}

.kobault-dropdown.open .kobault-dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.kobault-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: none;
    border-radius: 0 0 4px 4px;
    z-index: 100;
    display: none;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

/* WebKit scrollbar styling */
.kobault-dropdown-options::-webkit-scrollbar {
    width: 6px;
}

.kobault-dropdown-options::-webkit-scrollbar-track {
    background: transparent;
}

.kobault-dropdown-options::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

.kobault-dropdown-options::-webkit-scrollbar-thumb:hover {
    background-color: #999;
}

.kobault-dropdown.open .kobault-dropdown-options {
    display: block;
}

.kobault-dropdown-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.kobault-dropdown-option:hover {
    background-color: #f5f5f5;
}

.kobault-dropdown-option.active {
    font-weight: 600;
}

/* Multi-select dropdown styles */
.kobault-dropdown-multi .kobault-dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kobault-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-radius: 3px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
}

.kobault-dropdown-option.selected .kobault-checkbox {
    background-color: #333;
    border-color: #333;
}

.kobault-dropdown-option.selected .kobault-checkbox::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.kobault-dropdown-multi .kobault-dropdown-option:hover .kobault-checkbox {
    border-color: #999;
}

.kobault-option-label {
    flex: 1;
}

/* Multi-select button styles */
.kobault-buttons-multi .kobault-filter-btn.selected {
    background-color: #333;
    color: #fff;
}

/* Legacy native select (hidden but kept for fallback) */
.kobault-filter-select {
    display: none;
}

/* Button Filters */
.kobault-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kobault-filter-btn {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    color: #333;
}

.kobault-filter-btn:hover {
    background: #e0e0e0;
    border-color: #999;
}

.kobault-filter-btn.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* ===============================
   GRID LAYOUT
   =============================== */
.kobault-projects-container.kobault-projects-grid {
    display: grid !important;
    width: 100%;
}

.kobault-projects-grid {
    display: grid !important;
    width: 100%;
}

/* ===============================
   MASONRY LAYOUT
   =============================== */
.kobault-projects-container.kobault-projects-masonry {
    position: relative;
    width: 100%;
    /* Grid is used initially just to compute columns, then Isotope takes over */
    display: grid !important;
}

.kobault-projects-masonry {
    position: relative;
    width: 100%;
    display: grid !important;
}

.kobault-projects-container.kobault-projects-masonry.isotope,
.kobault-projects-masonry.isotope {
    /* Once Isotope is initialized, remove grid display */
    display: block !important;
}

.kobault-projects-masonry .kobault-project-item {
    /* Width will be set by JavaScript based on columns */
}

.kobault-projects-masonry.isotope .kobault-project-item {
    position: absolute;
}

/* Spanning Items (2 columns wide) */
.kobault-projects-masonry .kobault-project-span {
    /* Width will be calculated dynamically in JavaScript */
}

/* Grid layout spanning - uses CSS grid-column */
.kobault-projects-grid .kobault-project-span {
    grid-column: span 2;
}

/* Disable spanning on single column layouts */
@media (max-width: 767px) {
    .kobault-projects-grid .kobault-project-span {
        grid-column: span 1;
    }
}

/* ===============================
   PROJECT ITEMS
   =============================== */
.kobault-project-item {
    position: relative;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.kobault-project-item.hidden {
    display: none;
}

.kobault-project-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.kobault-project-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    display: block;
}

.kobault-project-image a {
    display: block;
    position: relative;
}

.kobault-project-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

/* ===============================
   HOVER EFFECTS
   =============================== */
.kobault-project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    padding: 20px;
}

.kobault-project-image:hover .kobault-project-overlay {
    opacity: 1;
}

.kobault-project-image:hover img {
    transform: scale(1.05);
}

.kobault-project-title {
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.4s ease 0.1s;
}

.kobault-project-image:hover .kobault-project-title {
    transform: translateY(0);
}

/* Overlay Content Wrapper */
.kobault-project-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Divider */
.kobault-project-divider {
    width: 50px;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.5);
    margin: 15px 0;
    transform: scaleX(0);
    transition: transform 0.4s ease 0.2s;
}

.kobault-project-image:hover .kobault-project-divider {
    transform: scaleX(1);
}

/* Terms */
.kobault-project-terms {
    color: #fff;
    font-size: 14px;
    margin: 0;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
}

.kobault-project-image:hover .kobault-project-terms {
    opacity: 1;
    transform: translateY(0);
}

/* ===============================
   RESPONSIVE
   =============================== */

/* Tablet */
@media (max-width: 1024px) {
    .kobault-filters-wrapper {
        gap: 15px;
    }

    .kobault-filter-groups {
        gap: 15px;
    }

    .kobault-filter-group {
        min-width: 150px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .kobault-filters-wrapper {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .kobault-filter-groups {
        flex-direction: column;
        gap: 15px;
    }

    .kobault-filter-group {
        width: 100%;
        min-width: auto;
    }

    .kobault-filter-action {
        width: 100%;
    }

    .kobault-filter-action-left {
        order: 0;
    }

    .kobault-filter-action-right {
        order: 2;
        margin-left: 0;
    }

    .kobault-show-all-btn,
    .kobault-reset-btn {
        width: 100%;
        text-align: center;
    }

    .kobault-filter-buttons {
        justify-content: flex-start;
    }

    .kobault-project-title {
        font-size: 18px;
    }
}

/* ===============================
   LOADING STATE
   =============================== */
.kobault-projects-container.loading {
    opacity: 0.5;
    pointer-events: none;
}

.kobault-projects-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===============================
   ISOTOPE SPECIFIC
   =============================== */
.kobault-projects-masonry.isotope {
    position: relative;
}

.kobault-project-item.isotope-item {
    transition: all 0.4s ease;
}

/* ===============================
   LOAD MORE BUTTON
   =============================== */
.kobault-load-more-wrapper {
    text-align: center;
    margin-top: 30px;
}

.kobault-load-more-btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kobault-load-more-btn:hover {
    background-color: #555;
}

.kobault-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
