/* Add new styles for search wrapper */
.wpgallery-search-wrapper {
    margin-bottom: 20px;
}

/* Adjust existing search input style */
.wpgallery-search-wrapper .wpgallery-top-search-input {
    width: 100%;
    padding: 4px 15px;
    height: auto;
    box-sizing: border-box;
    border: 1px solid #ccc; /* Lighter border */
    border-radius: 8px; /* More rounded corners */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); /* Subtle inner shadow */
    font-size: 16px;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.wpgallery-top-search-input:focus {
    border-color: var(--wpgallery-button-color, #0073aa);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05), 0 0 0 3px rgba(0, 115, 170, 0.2); /* Focus glow */
    outline: none;
}

/* Ensure wpgallery-container doesn't interfere with search wrapper */
.wpgallery-container {
    width: 100%;
    margin: 0 auto;
    padding: 0; /* Remove top/bottom padding here, handled by search wrapper margin */
}

.wpgallery-main-content-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.wpgallery-item {
    min-width: var(--wpgallery-item-min-width, 280px);
}

/* Filter positioning for left */
.wpgallery-container.wpgallery-filters-position-left .wpgallery-main-content-wrapper {
    flex-wrap: nowrap; /* Prevent wrapping when filters are on the left */
    align-items: flex-start; /* Align items to the top */
}

.wpgallery-container.wpgallery-filters-position-left .wpgallery-filters-wrapper {
    flex: 0 0 180px;
    max-width: 20%;
    min-width: 150px;
}

.wpgallery-items-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--wpgallery-item-min-width, 280px), 1fr));
    gap: 20px;
    width: 100%;
}

/* Updated Filter Toggles Style */
.wpgallery-filter-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* Slightly increased gap */
    justify-content: flex-start; /* Align toggles to start */
    margin-bottom: 15px; /* Add some bottom margin */
}

.wpgallery-filters-wrapper .wpgallery-filter-toggle {
    background-color: #f0f0f0;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none !important;
}

.wpgallery-filters-wrapper .wpgallery-filter-toggle:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
    color: #000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.wpgallery-filters-wrapper .wpgallery-filter-toggle.active {
    background-color: var(--wpgallery-button-color, #0073aa);
    color: white;
    border-color: var(--wpgallery-button-color, #0073aa);
    box-shadow: 0 3px 6px rgba(0, 115, 170, 0.4);
}

/* Adjust filter select for better appearance */
.wpgallery-filters select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #fff;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    -webkit-appearance: none; /* Remove default arrow */
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%230073aa%22%20d%3D%22M287%20197.3L159.9%2069.8c-4.8-4.8-12.5-4.8-17.3%200L5.4%20197.3c-4.8%204.8-4.8%2012.5%200%2017.3l8.5%208.5c4.8%204.8%2012.5%204.8%2017.3%200l118.2-118.2c4.8-4.8%2012.5-4.8%2017.3%200l118.2%20118.2c4.8%204.8%2012.5%204.8%2017.3%200l8.5-8.5c4.7-4.8%204.7-12.5%200-17.3z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px;
    padding-right: 30px; /* Make space for the custom arrow */
}

.wpgallery-filters select:focus {
    border-color: var(--wpgallery-button-color, #0073aa);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2);
    outline: none;
}

/* --- Overlay Style --- */
.wpgallery-style-overlay .wpgallery-item {
    position: relative;
    overflow: hidden;
}

.wpgallery-item-image {
    height: 200px;
}

.wpgallery-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wpgallery-style-overlay .wpgallery-item-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.wpgallery-style-overlay .wpgallery-item:hover .wpgallery-item-content {
    transform: translateY(0);
}

.wpgallery-item-content h3 {
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 0;
}

.wpgallery-item-content p {
    margin-bottom: 10px;
}

.wpgallery-style-overlay .wpgallery-item-content p {
    color: #eee;
}

.wpgallery-style-overlay .wpgallery-button {
    background-color: #008ec2;
}

/* --- Minimalist Style --- */
.wpgallery-style-minimalist .wpgallery-item {
    border: none;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.wpgallery-style-minimalist .wpgallery-item-image {
    height: auto;
    margin-bottom: 15px;
}

.wpgallery-style-minimalist .wpgallery-item-image img {
    border-radius: 5px;
}

.wpgallery-style-minimalist .wpgallery-item-content {
    padding: 0;
}

.wpgallery-style-minimalist .wpgallery-button {
    background-color: transparent;
    color: #0073aa;
    padding: 0;
    border-radius: 0;
    text-decoration: underline;
}

.wpgallery-style-minimalist .wpgallery-button:hover {
    background-color: transparent;
    color: #005177;
}

/* Original .wpgallery-button */
.wpgallery-button {
    display: inline-block;
    align-self: flex-start;
    transition: background-color 0.2s ease-in-out;
    border: none !important; /* Ensure no default border from browser */
    cursor: pointer; /* Indicate it's clickable */
}

.wpgallery-button:hover {
    background-color: #005177;
}

.wpgallery-filters-position-left .wpgallery-filter-toggles {
    flex-direction: column;
}

.wpgallery-item .wpgallery-button {
    background-color: var(--wpgallery-button-color, #0073aa);
    color: white;
    padding: 6px 12px;
    border: none !important;
    border-radius: 5px;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 14px;
    font-weight: 600;
}

.wpgallery-item .wpgallery-button:hover {
    background-color: #005177;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    color: white;
}
