/**
 * Kumrat Smart Search - Styles
 * With Tabs and Mobile Responsive
 */

/* Container */
.ktos-smart-search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Input */
.ktos-smart-search-input {
    width: 100%;
    height: 48px;
    padding: 0 20px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    background: #fff;
    transition: all 0.3s ease;
    outline: none;
}

.ktos-smart-search-input:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.1);
}

.ktos-smart-search-input::placeholder {
    color: #999;
}

/* Results Container */
.ktos-smart-search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: none;
    overflow: hidden;
    max-height: 70vh;
    overflow-y: auto;
}

.ktos-smart-search-results.active {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Search Tabs */
.ktos-search-tabs {
    display: flex;
    gap: 8px;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.ktos-search-tabs::-webkit-scrollbar {
    display: none;
}

.ktos-search-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ktos-search-tab:hover {
    border-color: #28a745;
    color: #28a745;
}

.ktos-search-tab.active {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}

.ktos-search-tab .tab-icon {
    font-size: 16px;
}

/* Results List */
.ktos-search-results-list {
    padding: 10px;
}

/* Result Card */
.ktos-smart-search-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
    outline: none;
}

.ktos-smart-search-card:hover,
.ktos-smart-search-card:focus {
    background-color: #f8f9fa;
}

.ktos-smart-search-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.ktos-smart-search-thumb-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.ktos-smart-search-info {
    flex: 1;
    min-width: 0;
}

.ktos-smart-search-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ktos-smart-search-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.ktos-smart-search-type {
    font-size: 12px;
    padding: 3px 8px;
    background: #e8f5e9;
    color: #28a745;
    border-radius: 12px;
    font-weight: 500;
}

.ktos-smart-search-dest {
    font-size: 12px;
    color: #666;
}

.ktos-smart-search-price {
    font-size: 14px;
    font-weight: 700;
    color: #28a745;
    margin-left: auto;
}

/* No Results */
.ktos-search-no-results {
    padding: 40px 20px;
    text-align: center;
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.no-results-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.no-results-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.no-results-suggestions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.suggestion-btn {
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.2s;
}

.suggestion-btn:hover {
    background: #28a745;
    color: #fff;
}

/* Footer */
.ktos-search-footer {
    padding: 15px;
    text-align: center;
    border-top: 1px solid #eee;
}

.ktos-view-all {
    color: #28a745;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.ktos-view-all:hover {
    text-decoration: underline;
}

/* Loading */
.ktos-search-loading {
    padding: 40px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #28a745;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: #666;
}

/* Error */
.ktos-search-error {
    padding: 30px;
    text-align: center;
}

.error-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.error-text {
    font-size: 14px;
    color: #dc3545;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .ktos-smart-search-container {
        max-width: 100%;
    }
    
    .ktos-smart-search-input {
        height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0 15px;
    }
    
    .ktos-smart-search-results {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        max-height: calc(100vh - 80px);
        border-radius: 12px;
    }
    
    .ktos-search-tabs {
        padding: 10px;
        gap: 6px;
    }
    
    .ktos-search-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .ktos-search-tab .tab-icon {
        font-size: 14px;
    }
    
    .ktos-search-tab .tab-label {
        display: none; /* Hide labels on small screens */
    }
    
    .ktos-smart-search-card {
        padding: 10px;
        gap: 12px;
    }
    
    .ktos-smart-search-thumb,
    .ktos-smart-search-thumb-placeholder {
        width: 50px;
        height: 50px;
    }
    
    .ktos-smart-search-title {
        font-size: 14px;
    }
    
    .ktos-smart-search-meta {
        gap: 6px;
    }
    
    .ktos-smart-search-price {
        font-size: 13px;
    }
    
    .no-results-suggestions {
        flex-direction: column;
        align-items: center;
    }
    
    .suggestion-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* Small Mobile */
@media (max-width: 375px) {
    .ktos-smart-search-results {
        left: 5px;
        right: 5px;
        top: 55px;
    }
    
    .ktos-search-tabs {
        padding: 8px;
    }
    
    .ktos-search-tab {
        padding: 6px 10px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .ktos-smart-search-container {
        max-width: 500px;
    }
    
    .ktos-smart-search-results {
        max-height: 60vh;
    }
}

/* ===== HEADER INTEGRATION ===== */
.kt-header .ktos-smart-search-container,
.kt-header-v2 .ktos-smart-search-container {
    max-width: 100%;
}

.kt-header .ktos-smart-search-input,
.kt-header-v2 .ktos-smart-search-input {
    background: rgba(255, 255, 255, 0.95);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ktos-smart-search-results {
        background: #1a1a1a;
        border: 1px solid #333;
    }
    
    .ktos-search-tabs {
        background: #252525;
        border-bottom-color: #333;
    }
    
    .ktos-search-tab {
        background: #333;
        border-color: #444;
        color: #ccc;
    }
    
    .ktos-search-tab.active {
        background: #28a745;
        border-color: #28a745;
        color: #fff;
    }
    
    .ktos-smart-search-card:hover,
    .ktos-smart-search-card:focus {
        background-color: #252525;
    }
    
    .ktos-smart-search-title {
        color: #fff;
    }
    
    .ktos-smart-search-thumb-placeholder {
        background: #333;
    }
}
