/**
 * Search Page Styles
 */

/* Search Header */
.search-header {
    background: var(--paws-card);
    padding: 12px 16px;
    position: sticky;
    top: 56px;
    z-index: 100;
    border-bottom: 1px solid var(--paws-border);
}

/* Search Form */
.search-form {
    width: 100%;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 12px;
    color: var(--paws-text-muted);
    font-size: 20px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 44px;
    border: 1px solid var(--paws-border);
    border-radius: 24px;
    background: var(--paws-bg);
    font-size: 0.95rem;
    color: var(--paws-text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--paws-primary);
    box-shadow: 0 0 0 3px rgba(var(--paws-primary-rgb), 0.1);
}

.search-input::placeholder {
    color: var(--paws-text-muted);
}

.search-clear {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--paws-text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.search-clear:hover {
    background: var(--paws-hover-bg);
}

.search-clear .material-icons {
    font-size: 18px;
}

/* Search Tabs */
.search-tabs {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.search-tabs::-webkit-scrollbar {
    display: none;
}

.search-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--paws-bg);
    color: var(--paws-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s;
}

.search-tab .material-icons {
    font-size: 18px;
}

.search-tab:hover {
    background: var(--paws-hover-bg);
    color: var(--paws-text);
}

.search-tab.active {
    background: var(--paws-primary);
    color: white;
}

/* Search Results */
.search-results {
    padding: 16px;
    max-width: var(--container-width-lg);
    margin: 0 auto;
}

.search-results-count {
    font-size: 0.85rem;
    color: var(--paws-text-muted);
    margin-bottom: 16px;
}

/* Empty State */
.search-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--paws-text-muted);
}

.search-empty .material-icons {
    font-size: 64px;
    opacity: 0.5;
    margin-bottom: 16px;
}

.search-empty p {
    margin: 0;
    font-size: 1rem;
}

.search-empty .search-hint {
    font-size: 0.85rem;
    margin-top: 8px;
    opacity: 0.7;
}

/* Diary List */
.diary-list {
    display: flex;
    flex-direction: column;
}

/* Pet List */
.pet-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pet-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--paws-card);
    border-radius: 12px;
    text-decoration: none;
    transition: background 0.2s;
}

.pet-card:hover {
    background: var(--paws-hover-bg);
}

.pet-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--paws-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pet-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pet-avatar .material-icons {
    font-size: 28px;
    color: var(--paws-text-muted);
}

.pet-info {
    flex: 1;
    min-width: 0;
}

.pet-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--paws-text);
    margin-bottom: 2px;
}

.pet-username {
    font-size: 0.85rem;
    color: var(--paws-text-muted);
    margin-bottom: 4px;
}

.pet-category {
    font-size: 0.75rem;
    color: var(--paws-primary);
    background: rgba(var(--paws-primary-rgb), 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.pet-arrow {
    color: var(--paws-text-muted);
    flex-shrink: 0;
}

/* Place List */
.place-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.place-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--paws-card);
    border-radius: 12px;
    text-decoration: none;
    transition: background 0.2s;
}

.place-card:hover {
    background: var(--paws-hover-bg);
}

.place-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--paws-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.place-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.place-thumb .material-icons {
    font-size: 28px;
    color: var(--paws-text-muted);
}

.place-info {
    flex: 1;
    min-width: 0;
}

.place-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--paws-text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.place-address {
    font-size: 0.85rem;
    color: var(--paws-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.place-arrow {
    color: var(--paws-text-muted);
    flex-shrink: 0;
}

/* Load More */
.search-load-more {
    text-align: center;
    margin-top: 24px;
}

.btn-load-more {
    display: inline-block;
    padding: 10px 24px;
    background: var(--paws-bg);
    border: 1px solid var(--paws-border);
    border-radius: 20px;
    color: var(--paws-text);
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-load-more:hover {
    background: var(--paws-hover-bg);
    border-color: var(--paws-primary);
    color: var(--paws-primary);
}

/* Search History */
.search-history {
    margin-top: 16px;
}

.search-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.search-history-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--paws-text);
}

.search-history-clear {
    background: none;
    border: none;
    color: var(--paws-primary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.search-history-clear:hover {
    background: rgba(var(--paws-primary-rgb), 0.1);
}

.search-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-history-item {
    display: flex;
    align-items: center;
    background: var(--paws-card);
    border-radius: 8px;
    transition: background 0.2s;
}

.search-history-item:hover {
    background: var(--paws-hover-bg);
}

.search-history-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--paws-text);
    min-width: 0;
}

.search-history-link .material-icons {
    font-size: 20px;
    color: var(--paws-text-muted);
    flex-shrink: 0;
}

.search-history-text {
    flex: 1;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-history-remove {
    background: none;
    border: none;
    color: var(--paws-text-muted);
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-history-remove:hover {
    color: var(--paws-danger);
}

.search-history-remove .material-icons {
    font-size: 18px;
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--paws-bg);
    z-index: 1100;
    display: none;
    flex-direction: column;
}

.search-overlay.show {
    display: flex;
}

.search-overlay-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--paws-card);
    border-bottom: 1px solid var(--paws-border);
}

.search-overlay-back {
    background: none;
    border: none;
    color: var(--paws-text);
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.search-overlay-back:hover {
    background: var(--paws-hover-bg);
}

.search-overlay-form {
    flex: 1;
    display: flex;
    align-items: center;
}

.search-overlay-input {
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--paws-text);
}

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

.search-overlay-input::placeholder {
    color: var(--paws-text-muted);
}

.search-overlay-submit {
    background: none;
    border: none;
    color: var(--paws-primary);
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-overlay-submit:disabled {
    color: var(--paws-text-muted);
    cursor: default;
}

.search-overlay-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.search-overlay-history {
    padding: 0;
}

/* Responsive */
@media (min-width: 768px) {
    .search-header {
        padding: 16px 24px;
    }

    .search-results {
        padding: 24px;
    }

    .pet-card,
    .place-card {
        padding: 16px;
    }

    /* Desktop: Smaller overlay */
    .search-overlay {
        top: 56px;
        bottom: auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 100%;
        max-width: var(--container-width-lg);
        max-height: 400px;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    .search-history {
        max-width: var(--container-width-lg);
        margin-left: auto;
        margin-right: auto;
    }
}
