/**
 * Triply Smart Search Pro - Styles
 * Matches the design in the reference screenshot
 */

/* ===== Search Wrapper ===== */
.tss-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ===== Search Form ===== */
.tss-search-form {
    position: relative;
    width: 100%;
}

.tss-search-inner {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #d1d5db;
    overflow: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tss-search-inner:focus-within {
    border-color: #9ca3af;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ===== Search Input ===== */
.tss-search-input {
    flex: 1;
    width: 100%;
    padding: 18px 24px;
    border: none;
    outline: none;
    font-size: 15px;
    font-weight: 400;
    color: #1f2937;
    background: transparent;
    line-height: 1.5;
}

.tss-search-input::placeholder {
    color: #9ca3af;
    font-size: 14px;
    font-weight: 400;
}

.tss-search-input:focus {
    outline: none;
}

/* ===== Search Button ===== */
.tss-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 32px;
    margin: 4px;
    background: #2d2d2d;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 52px;
}

.tss-search-button:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 45, 45, 0.25);
}

.tss-search-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(45, 45, 45, 0.2);
}

.tss-search-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.tss-btn-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tss-btn-loader svg {
    animation: tss-spin 0.8s linear infinite;
}

@keyframes tss-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Suggestions Dropdown ===== */
.tss-suggestions-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    overflow: hidden;
    animation: tss-dropdown-in 0.2s ease;
}

@keyframes tss-dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tss-suggestions-list {
    max-height: 420px;
    overflow-y: auto;
    padding: 8px 0;
}

/* Scrollbar styling */
.tss-suggestions-list::-webkit-scrollbar {
    width: 6px;
}

.tss-suggestions-list::-webkit-scrollbar-track {
    background: transparent;
}

.tss-suggestions-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.tss-suggestions-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===== Suggestion Item ===== */
.tss-suggestion-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: inherit;
}

.tss-suggestion-item:last-child {
    border-bottom: none;
}

.tss-suggestion-item:hover,
.tss-suggestion-item.tss-active {
    background: #f9fafb;
}

.tss-suggestion-thumbnail {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f3f4f6;
}

.tss-suggestion-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.tss-suggestion-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 3px 0;
    line-height: 1.4;
}

.tss-suggestion-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #6b7280;
}

.tss-suggestion-price {
    color: #059669;
    font-weight: 600;
}

.tss-suggestion-duration {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tss-match-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

.tss-match-exact {
    background: #d1fae5;
    color: #065f46;
}

.tss-match-title {
    background: #dbeafe;
    color: #1e40af;
}

.tss-match-content {
    background: #fef3c7;
    color: #92400e;
}

/* ===== Dropdown Footer ===== */
.tss-suggestions-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
    color: #6b7280;
}

.tss-view-all-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.15s ease;
}

.tss-view-all-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ===== No Results Message ===== */
.tss-no-results {
    padding: 32px 20px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.tss-no-results-icon {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

/* ===== Search Results Page ===== */
.tss-results-page {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.tss-results-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.tss-results-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.tss-results-header .tss-query-highlight {
    color: #2563eb;
}

.tss-results-count {
    font-size: 14px;
    color: #6b7280;
}

.tss-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.tss-result-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: all 0.25s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.tss-result-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
    border-color: #d1d5db;
}

.tss-result-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    background: #f3f4f6;
}

.tss-result-content {
    padding: 20px;
}

.tss-result-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.tss-result-excerpt {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 16px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tss-result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tss-result-price {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
}

.tss-result-duration {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tss-no-results-page {
    text-align: center;
    padding: 80px 24px;
    max-width: 500px;
    margin: 0 auto;
}

.tss-no-results-page-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
}

.tss-no-results-page h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.tss-no-results-page p {
    font-size: 15px;
    color: #6b7280;
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.tss-back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #2d2d2d;
    color: #ffffff;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.tss-back-home:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 45, 45, 0.25);
}

/* ===== Pagination ===== */
.tss-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}

.tss-pagination a,
.tss-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.tss-pagination a {
    color: #374151;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.tss-pagination a:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.tss-pagination .current {
    background: #2d2d2d;
    color: #ffffff;
    border: 1px solid #2d2d2d;
}

.tss-pagination .dots {
    color: #9ca3af;
    background: transparent;
    border: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .tss-search-inner {
        border-radius: 12px;
    }
    
    .tss-search-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .tss-search-button {
        padding: 14px 20px;
        min-height: 48px;
        font-size: 14px;
        border-radius: 10px;
    }
    
    .tss-suggestions-dropdown {
        border-radius: 12px;
    }
    
    .tss-results-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .tss-results-page {
        margin: 24px auto;
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .tss-search-button {
        padding: 12px 16px;
    }
    
    .tss-btn-text {
        font-size: 13px;
    }
}

/* ===== Triply Theme Compatibility ===== */
.elementor-widget-container .tss-search-wrapper,
.triply-content .tss-search-wrapper,
.site-content .tss-search-wrapper {
    max-width: 100%;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .tss-search-inner {
        background: #1f2937;
        border-color: #374151;
    }
    
    .tss-search-input {
        color: #f9fafb;
    }
    
    .tss-search-input::placeholder {
        color: #9ca3af;
    }
    
    .tss-suggestions-dropdown {
        background: #1f2937;
        border-color: #374151;
    }
    
    .tss-suggestion-item:hover,
    .tss-suggestion-item.tss-active {
        background: #374151;
    }
    
    .tss-suggestion-title {
        color: #f9fafb;
    }
}
