/* public/search.css */

/* --- Container & Layout --- */
#search-page-container {
    padding: 20px;
    padding-bottom: 100px; /* Space for nav */
    max-width: 1200px;
    margin: 0 auto;
}

.search-bar-container {
    position: sticky;
    top: 0;
    background: #0B0C10; /* Match theme background to cover content when scrolling */
    z-index: 100;
    padding: 10px 0 20px 0;
    margin-bottom: 20px;
}

/* --- Search Category Label --- */
.search-category-label {
    color: #888;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    padding-left: 5px;
}

/* --- Type Selector --- */
.search-type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none; /* Firefox */
}
.search-type-selector::-webkit-scrollbar { display: none; }

.type-btn {
    background: #1f2833;
    color: #c5c6c7;
    border: 1px solid #333; /* Default border darker */
    padding: 8px 18px; /* Slightly wider */
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.type-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
}

/* --- Active States per Type --- */

/* Anime: Neon Blue */
.type-btn[data-type="anime"].active {
    background: #2196F3;
    border-color: #2196F3;
    color: #fff;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

/* Donghua: Deep Red/Pink */
.type-btn[data-type="donghua"].active {
    background: #E91E63;
    border-color: #E91E63;
    color: #fff;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
}

/* Manga: Vibrant Orange */
.type-btn[data-type="manga"].active {
    background: #FF9800;
    border-color: #FF9800;
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
}

/* No-Sub: Purple */
.type-btn[data-type="nosub"].active {
    background: #9C27B0;
    border-color: #9C27B0;
    color: #fff;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}


/* --- Input Field --- */
.input-wrapper {
    position: relative;
    width: 100%;
}

#search-input {
    width: 100%;
    padding: 12px 15px 12px 45px; /* Left padding for icon */
    background-color: #1f2833;
    border: 1px solid #333;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

#search-input:focus {
    outline: none;
    border-color: #45a29e;
    box-shadow: 0 0 15px rgba(69, 162, 158, 0.2);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #66fcf1;
    font-size: 1.1rem;
    pointer-events: none;
}

/* --- Results Grid --- */
.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Adaptive columns */
    gap: 15px;
}

.anime-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s;
    position: relative;
}

.anime-card:hover {
    transform: translateY(-5px);
}

.card-img-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3; /* Standard poster ratio */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.anime-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.anime-card:hover img {
    transform: scale(1.05);
}

.anime-card h3 {
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    color: #e0e0e0;
}

/* --- Skeleton Loading --- */
.skeleton {
    pointer-events: none;
}
.skeleton-img {
    width: 100%;
    height: 100%;
    background: #1f2833;
    animation: pulse 1.5s infinite;
}
.skeleton-title {
    width: 80%;
    height: 15px;
    background: #1f2833;
    border-radius: 4px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* --- Message Text --- */
.message-text {
    text-align: center;
    color: #888;
    margin-top: 30px;
    font-size: 1rem;
    grid-column: 1 / -1;
}

/* --- Badges on Cards --- */
.type-badge {
    position: absolute;
    top: 0;
    left: 0;
    padding: 6px 12px 6px 10px;
    border-radius: 0 0 16px 0; /* Sticky Corner Effect */
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    border-right: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.type-badge.badge-anime {
    background: linear-gradient(135deg, #2196F3, #00aaff);
}

.type-badge.badge-donghua {
    background: linear-gradient(135deg, #E91E63, #ff5252);
}

.type-badge.badge-manga {
    background: linear-gradient(135deg, #FF9800, #ffc107);
}

.type-badge.badge-nosub {
    background: linear-gradient(135deg, #9C27B0, #673ab7);
}
