/**
 * Course Search & Filter - Airbnb-Inspired Design
 * Pure CSS styling - NO functionality changes
 */

/* ========================================
   Main Search Wrapper - Airbnb Style
   ======================================== */
   .csf-search-wrapper {
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   Search Form Container - Rounded Pill
   ======================================== */
.csf-search-form {
    width: 100%;
    background: #ffffff;
    border-radius: 50px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.3s ease;
}

.csf-search-form:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Search Fields Grid - Airbnb Layout
   ======================================== */
.csf-search-fields {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1.2fr auto;
    align-items: center;
    gap: 16px;
    padding: 8px 8px 8px 24px;
}

/* ========================================
   Individual Field Styling
   ======================================== */
.csf-field {
    position: relative;
    padding: 0;
}

/* Add vertical dividers between fields */
.csf-keyword-field::after,
.csf-category-field::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 32px;
    background-color: #DDDDDD;
}

/* ========================================
   Keyword Field with Autocomplete
   ======================================== */
.csf-keyword-field {
    position: relative;
}

.csf-input-wrapper {
    position: relative;
    width: 100%;
}

/* ========================================
   Input & Select Base Styles - Airbnb Clean
   ======================================== */
.csf-input,
.csf-select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: #222222;
    border: none !important;
    background-color: transparent;
    transition: all 0.2s ease;
    outline: none;
    border-radius: 32px;
}

.csf-input::placeholder {
    color: #717171;
    font-weight: 400;
}

.csf-input:focus,
.csf-select:focus {
    background-color: #F7F7F7;
}

/* Remove default select arrow */
.csf-select {
    appearance: none;
    cursor: pointer;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23717171' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.csf-select option {
    padding: 10px;
    font-size: 14px;
}

/* ========================================
   Search Icon - Minimal Style
   ======================================== */
.csf-search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #717171;
    pointer-events: none;
    display: none; /* Hide for cleaner look */
}

/* ========================================
   Search Button - Airbnb Pink/Red
   ======================================== */
.csf-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 48px;
    height: 48px;
    min-width: 48px;
    font-size: 0;
    color: #ffffff;
    background: linear-gradient(to right, #E61E4D 0%, #E31C5F 50%, #D70466 100%);
    border: none;
    border-radius: 50% !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(230, 30, 77, 0.3);
}

.csf-button::before {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM16.5 16.5l-4-4' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.csf-button:hover {
    background: linear-gradient(to right, #D01346 0%, #C9184F 50%, #BD0458 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(230, 30, 77, 0.4);
}

.csf-button:active {
    transform: scale(1);
}

/* ========================================
   Autocomplete Results Dropdown
   ======================================== */
.csf-autocomplete-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 480px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #DDDDDD;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling */
.csf-autocomplete-results::-webkit-scrollbar {
    width: 8px;
}

.csf-autocomplete-results::-webkit-scrollbar-track {
    background: #F7F7F7;
    border-radius: 10px;
}

.csf-autocomplete-results::-webkit-scrollbar-thumb {
    background: #DDDDDD;
    border-radius: 10px;
}

.csf-autocomplete-results::-webkit-scrollbar-thumb:hover {
    background: #B0B0B0;
}

/* ========================================
   Results Sections
   ======================================== */
.csf-results-section {
    padding: 12px 0;
}

.csf-results-section:not(:last-child) {
    border-bottom: 1px solid #EBEBEB;
}

.csf-results-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #717171;
    letter-spacing: 0.8px;
}

.csf-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ========================================
   Result Items - Airbnb Style
   ======================================== */
.csf-result-item a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: #222222;
    transition: background-color 0.15s ease;
}

.csf-result-item a:hover {
    background-color: #F7F7F7;
}

/* Category Items */
.csf-category-item .csf-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 12px;
    background-color: #F7F7F7;
    border-radius: 8px;
    color: #717171;
}

.csf-category-item .csf-result-name {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
    color: #222222;
}

.csf-category-item .csf-result-count {
    font-size: 12px;
    color: #717171;
    margin-left: 8px;
}

/* Course Items */
.csf-course-item a {
    align-items: flex-start;
}

.csf-result-image {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    margin-right: 12px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #F7F7F7;
}

.csf-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.csf-result-details {
    flex: 1;
    min-width: 0;
}

.csf-result-title {
    display: block;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
    color: #222222;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.csf-result-price {
    display: block;
    font-size: 13px;
    color: #717171;
    font-weight: 400;
}

/* ========================================
   Loading & Error States
   ======================================== */
.csf-loading,
.csf-no-results,
.csf-error {
    padding: 32px 20px;
    text-align: center;
    color: #717171;
    font-size: 14px;
}

.csf-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #E61E4D;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Search Indicator Banner
   ======================================== */
.csf-search-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    font-size: 15px;
    animation: slideDown 0.3s ease;
}

.csf-search-indicator svg {
    vertical-align: middle;
    margin-right: 8px;
}

.csf-search-indicator strong {
    font-weight: 600;
    margin-left: 6px;
}

.csf-search-indicator a {
    color: white;
    text-decoration: none;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 14px;
}

.csf-search-indicator a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* ========================================
   Responsive Design - Mobile First
   ======================================== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    .csf-search-wrapper {
        padding: 16px;
    }
    
    .csf-search-form {
        border-radius: 32px;
    }
    
    .csf-search-fields {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 12px;
    }
    
    /* Remove dividers on mobile */
    .csf-keyword-field::after,
    .csf-category-field::after {
        display: none;
    }
    
    /* Add horizontal dividers instead */
    .csf-field:not(:last-child) {
        border-bottom: 1px solid #EBEBEB;
        padding-bottom: 12px;
        margin-bottom: 12px;
    }
    
    .csf-input,
    .csf-select {
        padding: 12px 36px 12px 14px;
        font-size: 15px;
    }
    
    .csf-button {
        width: 100%;
        height: 48px;
        border-radius: 24px;
        font-size: 16px;
        font-weight: 600;
    }
    .csf-button::before {
        content: '';
        display: block;
        width: 18px;
        height: 18px;
        background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM16.5 16.5l-4-4' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
    }
    
    
    
    .csf-result-image {
        width: 48px;
        height: 48px;
    }
    
    .csf-result-title {
        font-size: 13px;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .csf-search-wrapper {
        padding: 12px;
    }
    
    .csf-input,
    .csf-select {
        padding: 10px 32px 10px 12px;
        font-size: 14px;
    }
    
    .csf-button {
        height: 44px;
        font-size: 15px;
    }
    .csf-button::before {
        content: '';
        display: block;
        width: 18px;
        height: 18px;
        background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM16.5 16.5l-4-4' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
    }
    
    .csf-autocomplete-results {
        max-height: 360px;
        border-radius: 12px;
    }
    
    .csf-result-item a {
        padding: 10px 16px;
    }
    
    .csf-search-indicator {
        flex-direction: column;
        gap: 12px;
        padding: 14px 18px;
        font-size: 14px;
    }
    
    .csf-search-indicator a {
        width: 100%;
        text-align: center;
    }
}

/* ========================================
   Focus States for Accessibility
   ======================================== */
.csf-input:focus-visible,
.csf-select:focus-visible,
.csf-button:focus-visible {
    
    outline-offset: 2px;
}

.csf-result-item a:focus-visible {
    outline: 2px solid #E61E4D;
    outline-offset: -2px;
    background-color: #F7F7F7;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .csf-search-wrapper,
    .csf-autocomplete-results,
    .csf-search-indicator {
        display: none;
    }
}

/* ========================================
   Dark Mode Support (Optional)
   ======================================== */
@media (prefers-color-scheme: dark) {
    .csf-search-form {
        background-color: #1A1A1A;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
    }
    
    .csf-input,
    .csf-select {
        color: #FFFFFF;
    }
    
    .csf-input::placeholder {
        color: #B0B0B0;
    }
    
    .csf-input:focus,
    .csf-select:focus {
        background-color: #2A2A2A;
    }
    
    .csf-keyword-field::after,
    .csf-category-field::after {
        background-color: #3A3A3A;
    }
    
    .csf-autocomplete-results {
        background: #1A1A1A;
        border-color: #3A3A3A;
    }
    
    .csf-result-item a {
        color: #FFFFFF;
    }
    
    .csf-result-item a:hover {
        background-color: #2A2A2A;
    }
    
    .csf-category-item .csf-result-icon {
        background-color: #2A2A2A;
        color: #B0B0B0;
    }
    
    .csf-result-image {
        background-color: #2A2A2A;
    }
}

/* ========================================
   High Contrast Mode Support
   ======================================== */
@media (prefers-contrast: high) {
    .csf-search-form {
        border: 2px solid currentColor;
    }
    
    .csf-button {
        border: 2px solid white;
    }
}
