@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');

:root {
    --primary-color: #4da8da;
    --secondary-color: #1a1a2e;
    --accent-color: #e63946;
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
    --card-bg: rgba(30, 30, 30, 0.85);
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --shadow: 0 8px 16px rgba(0,0,0,0.3);
    --border-radius: 12px;
}

.inventory-container {
    max-width: 1150px;
    margin: 0 auto;
    padding: 2rem 1rem;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    color: var(--text-main);
}

/* Filter Section */
.filter-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 15px 40px rgba(0,0,0,0.9);
    border: 1px solid #444;
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 9999;
    width: 100%;
    box-sizing: border-box;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

@media screen and (max-width: 480px) {
    .filter-card {
        grid-template-columns: repeat(2, 1fr);
        padding: 1.5rem 0.5rem 1rem 0.5rem;
        gap: 0.8rem;
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        margin-bottom: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.6);
        transition: max-height 0.4s ease, padding 0.4s ease;
    }
    .filter-card.is-collapsed {
        grid-template-columns: repeat(2, 1fr);
        padding: 1rem 0.5rem 0.6rem 0.5rem;
    }
    .filter-card.is-collapsed .filter-group:nth-child(n+3) {
        display: none;
    }
}

.mobile-filter-toggle {
    display: none;
}
@media screen and (max-width: 480px) {
    .mobile-filter-toggle {
        display: flex;
        position: absolute;
        top: -20px;
        right: 15px;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        color: #fff;
        background: #f39c12; /* Vibrant orange */
        border-radius: 50%;
        cursor: pointer;
        font-size: 1.2rem;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.6);
    }
}

.filter-group label {
    display: none;
}

.filter-group select {
    box-sizing: border-box;
    width: 100% !important;
    padding: 0.8rem 1rem;
    border: 1px solid #555;
    border-radius: 8px;
    font-size: 1.05rem;
    background: #1e1e1e;
    color: var(--text-main);
    transition: all 0.3s ease;
    appearance: none;
    line-height: normal;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.05);
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 1rem top 50%;
    background-size: 0.65rem auto;
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(43, 88, 118, 0.2);
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.results-count {
    font-size: 1.2rem;
    font-weight: 600;
}

.results-count span {
    color: var(--primary-color);
    font-size: 1.4rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Bike Card */
.bike-card {
    background: #2a2a2a;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.bike-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.bike-image {
    display: block;
    width: 98%;
    height: auto;
    margin: 4px auto;
    border-radius: 7px;
    background: #000;
    object-fit: cover;
}

.bike-details {
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.bike-store-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    backdrop-filter: blur(5px);
}

.bike-maker {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bike-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0.5rem 0 1rem 0;
    color: var(--text-main);
    line-height: 1.4;
    border-bottom: 2px solid #111;
    box-shadow: 0 4px 6px -5px rgba(0, 0, 0, 0.8);
    padding-bottom: 0.8rem;
}

.bike-specs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    font-size: 0.8rem;
    color: #ccc;
    white-space: nowrap;
}

.bike-specs span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.bike-specs i {
    width: 1.1rem;
    text-align: center;
}

.bike-price {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    font-size: 1.5rem;
    font-weight: 800;
    color: #ff3366; /* Pop pink color */
}

.bike-price span {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-right: 5px;
    margin-bottom: 0.3rem;
}

/* Loader */
.loader-container {
    display: none;
    justify-content: center;
    padding: 3rem 0;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-bottom-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: var(--text-muted);
    background: var(--card-bg);
    border-radius: var(--border-radius);
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .filter-card {
        flex-direction: column;
        align-items: stretch;
    }
}



/* === Favorites Feature === */

/* Heart icon inside Bike Card */
.bike-price-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    margin-top: auto;
    border-top: 1px solid #222;
    padding-top: 0.8rem;
}

.card-fav-btn {
    cursor: pointer;
    font-size: 22px;
    color: #ccc;
    transition: color 0.3s ease, transform 0.2s ease;
    padding: 5px;
}

.card-fav-btn.is-active {
    color: #f72585;
}

.card-fav-btn:hover {
    transform: scale(1.2);
}

/* Global Favorite Floating Button (PC & SP) */
.global-fav-float {
    display: none; /* Hidden on PC by default */
    position: fixed;
    bottom: 145px;
    left: 20px;
    width: 50px;
    height: 50px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #ccc;
    font-size: 24px;
    transition: transform 0.2s ease;
}

.global-fav-float.has-favorites {
    color: #f72585;
}

.global-fav-float.is-filtering {
    background-color: #f72585;
    color: #fff;
}

.global-fav-float .fav-count-float {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #333;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none; /* Hide when 0 */
    justify-content: center;
    align-items: center;
}

.global-fav-float.has-favorites .fav-count-float {
    display: flex;
}

.global-fav-float.is-filtering .fav-count-float {
    background-color: #fff;
    color: #f72585;
}

/* Toast Notification */
.favorite-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    z-index: 2000;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    line-height: 1.5;
    width: 90%;
    max-width: 400px;
}

.favorite-toast.show {
    bottom: 30px;
}

/* Media Queries for Favorites */
@media (max-width: 640px) {
    .favorite-toast.show {
        bottom: 240px; /* Above the floating button */
    }
}

/* Hide the injected SP menu drawer on PC for search.php */
@media (min-width: 641px) {
    .search-page-sp-menu { display: none !important; }
}


/* Global PC Favorite Icon (Circle styled like SP) */
.global-fav-pc {
    display: flex;
    position: relative;
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 50%;
    border: 2px solid #ccc;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #ccc;
    font-size: 20px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.global-fav-pc.has-favorites {
    color: #f72585;
    border-color: #f72585;
}

.global-fav-pc.is-filtering {
    background-color: #f72585;
    color: #fff;
    border-color: #f72585;
}

.global-fav-pc .fav-count-pc {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #333;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: none; /* Hide when 0 */
    justify-content: center;
    align-items: center;
}

.global-fav-pc.has-favorites .fav-count-pc {
    display: flex;
}

.global-fav-pc.has-favorites .fav-count-pc {
    background-color: #f72585;
}

.global-fav-pc.is-filtering .fav-count-pc {
    background-color: #fff;
    color: #f72585;
}


@media (max-width: 640px) {
    .global-fav-pc {
        display: none !important;
    }
    .global-fav-float {
        display: flex; /* Show on SP */
    }
}
/* Search Action Container & Submit Button */
.search-action-container {
    text-align: center;
    background: linear-gradient(135deg, #333 0%, #333 100%);
    padding: 20px;
    border-radius: 12px;
    margin-top: -30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.btn-search-submit {
    background-color: #ff6600;
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 102, 0, 0.4);
    transition: background-color 0.3s ease, transform 0.2s ease;
    white-space: nowrap; /* Keep on one line */
    width: 100%;
    max-width: 400px;
}

.btn-search-submit:hover {
    background-color: #e65c00;
    transform: translateY(-2px);
}

/* Responsive adjustments for submit button */
@media screen and (max-width: 480px) {
    .btn-search-submit {
        font-size: 1rem;
        padding: 12px 10px;
        letter-spacing: -0.5px;
    }
    
    /* Override bottom-fixed behavior for specific filter cards on SP (used in index.htm) */
    .filter-card.static-on-sp {
        position: static !important;
        border-radius: 12px !important;
        margin-bottom: 0 !important;
        padding: 1.5rem 1rem !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3) !important;
    }
}
