/**
 * CS Kids Enhanced Search Widget Styles
 * Horizontal shelf design matching parent site
 */

.csk-search-widget {
    position: absolute;
    right: 0;
    width: auto;
    max-width: none;
    z-index: 200;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Search Form - Horizontal Layout */
.csk-search-form {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    background: #fff;
    border: 2px solid #e5e7eb !important;
    border-radius: 50px;
    padding: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    outline: none;
    box-shadow: none;
}

.csk-search-form:focus-within {
    border-color: #ffa500;
    box-shadow: 0 2px 8px rgba(255, 165, 0, 0.15);
}

/* Filters Container - Slides in from left */
.csk-search-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    padding: 0;
}

.csk-search-expanded .csk-search-filters {
    width: auto;
    opacity: 1;
    padding: 4px 12px 4px 16px;
    overflow: visible;
}

/* Filter Label */
.csk-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #ffa500;
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
    flex-shrink: 0;
}

/* Year Buttons Container */
.csk-year-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Individual Year Button */
.csk-year-button {
    position: relative;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.csk-year-button input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.csk-year-button span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    line-height: 1;
}

.csk-year-button:hover span {
    background: #e5e7eb;
    border-color: #ffa500;
    transform: scale(1.05);
}

.csk-year-button input[type="checkbox"]:checked + span {
    background: #ffa500;
    color: #fff;
    border-color: #ffa500;
}

.csk-year-button input[type="checkbox"]:focus + span {
    outline: 2px solid #ffa500;
    outline-offset: 2px;
}

/* Clear/All Button */
.csk-year-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #fff;
    color: #374151;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.csk-year-clear:hover {
    border-color: #ffa500;
    color: #ffa500;
    transform: scale(1.05);
}

/* Search Input Wrapper */
.csk-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

/* Search Input */
.csk-search-input {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 44px 10px 16px;
    font-size: 15px;
    outline: none;
    color: #1f2937;
    width: 100%;
}

.csk-search-input::placeholder {
    color: #9ca3af;
}

/* Collapsed state - hide input text */
.csk-search-widget:not(.csk-search-expanded) .csk-search-input::placeholder {
    opacity: 0;
    transition: opacity 0.2s;
}

.csk-search-expanded .csk-search-input::placeholder {
    opacity: 1;
    transition: opacity 0.3s 0.15s;
}

/* Search Submit Button - Subtle Icon */
.csk-search-submit {
    position: absolute;
    right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #ffa500;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.csk-search-submit:hover {
    background: rgba(255, 165, 0, 0.1);
    transform: scale(1.1);
}

.csk-search-submit:active {
    transform: scale(0.95);
}

.csk-search-submit svg {
    width: 18px;
    height: 18px;
}

/* Collapsed state - compact search bar */
.csk-search-widget:not(.csk-search-expanded) .csk-search-form {
    width: 240px;
}

/* Expanded state - wide search bar that covers menu button */
.csk-search-widget.csk-search-expanded .csk-search-form {
    width: 650px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .csk-search-widget {
        position: relative;
        width: 100%;
    }

    .csk-search-widget:not(.csk-search-expanded) .csk-search-form,
    .csk-search-widget.csk-search-expanded .csk-search-form {
        width: 100%;
        max-width: 100%;
    }

    .csk-search-form {
        flex-wrap: wrap;
    }

    .csk-search-filters {
        order: 2;
        width: 100%;
        padding: 8px 12px;
        border-top: 1px solid #e5e7eb;
    }

    .csk-search-expanded .csk-search-filters {
        width: 100%;
    }

    .csk-search-input-wrapper {
        order: 1;
        width: 100%;
    }

    .csk-year-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .csk-filter-label {
        font-size: 12px;
    }

    .csk-year-button span,
    .csk-year-clear {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .csk-search-input {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 8px 40px 8px 12px;
    }
}

