/* =========================================
    1. 全体レイアウト
   ========================================= */
body {
    margin: 0;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: #f3f3f3;
    color: #4a4a4a;
}

main.container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    gap: 25px;
    padding: 20px;
    align-items: flex-start;
}

aside.sidebar {
    flex: 0 0 240px;
}

div.content {
    flex: 1;
    min-width: 0;
}

/* =========================================
    2. ヘッダー
   ========================================= */
header {
    background-color: #eee0c8;
    padding: 10px 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 22px;
    font-weight: bold;
    color: #5d4037;
}

.logo-img {
    height: 35px;
    margin-right: 8px;
}

nav ul,
.nav-list {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: #5d4037;
    font-weight: bold;
    font-size: 14px;
    transition: text-decoration 0.2s ease, opacity 0.2s ease;
}

nav a:hover {
    text-decoration: underline;
    opacity: 0.85;
}

.welcome-text {
    color: #5d4037;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
}

/* =========================================
    3. 検索エリア (スリム版)
   ========================================= */
.search-section-wrapper {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.search-section {
    max-width: 700px;
    margin: 0 auto;
    padding: 15px 0;
}

.search-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.category-toggle {
    display: flex;
    background: #f0f0f0;
    padding: 3px;
    border-radius: 8px;
}

.category-toggle input {
    display: none;
}

.category-toggle label {
    padding: 4px 18px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    color: #777;
}

.category-toggle input:checked + label {
    background: #75AA5A;
    color: white;
}

.search-bar {
    display: flex;
    width: 100%;
}

.search-bar input {
    flex: 1;
    padding: 8px 15px;
    border: 1px solid #999;
    border-right: none;
    border-radius: 25px 0 0 25px;
    font-size: 14px;
    outline: none;
}

.search-bar button {
    padding: 8px 25px;
    background-color: #555;
    color: white;
    border: 1px solid #555;
    border-radius: 0 25px 25px 0;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

/* =========================================
    4. メイングリッド
   ========================================= */
.page-header {
    background-color: #e8e8e8;
    padding: 15px 20px;
    margin-top: 0;
    margin-bottom: 30px;
    border-radius: 8px;
    color: #5d4037;
    font-size: 1.3rem;
    border-left: 8px solid #75AA5A;
}

.section-title {
    font-size: 1.1rem;
    color: #5d4037;
    margin-bottom: 20px;
    border-left: 5px solid #75AA5A;
    padding-left: 10px;
    text-align: left;
}

.page-section {
    padding-left: 20px;
    margin-bottom: 40px;
}

.section-body {
    padding-left: 20px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    width: 100%;
    margin: 0;
}

.product-card-link {
    text-decoration: none;
    color: inherit;
}

.product-card {
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.rank-badge {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    background: #ff5722;
    color: white;
    font-weight: bold;
    padding: 4px 10px;
    border-bottom-right-radius: 8px;
    font-size: 0.8rem;
}

.product-image {
    width: 100%;
    height: 110px;
    object-fit: contain;
    background-color: #fff;
    padding: 10px;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-info {
    padding: 10px;
    flex-grow: 1;
}

.brand-name {
    font-size: 0.7rem;
    color: #888;
    margin: 0;
}

.product-title {
    font-size: 0.9rem;
    font-weight: bold;
    margin: 0 0 10px 0;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
}

.price {
    font-weight: bold;
    color: #e44d26;
    font-size: 1rem;
}

.btn-mini {
    background-color: #75AA5A;
    color: white;
    border: none;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-mini:hover {
    background-color: #5e8a48;
}

.btn-primary {
    background-color: #75AA5A;
    border: none;
    border-radius: 20px;
    padding: 5px 20px;
}

/* =========================================
    5. サイドバーウィジェット
   ========================================= */
.sidebar-widget {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #ddd;
    margin-bottom: 15px;
}

.widget-title {
    font-size: 14px;
    font-weight: bold;
    border-left: 4px solid #75AA5A;
    padding-left: 10px;
    margin-bottom: 12px;
}

.pet-type-select-form {
    margin-top: 4px;
}

.pet-type-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 13px;
    box-sizing: border-box;
    background-color: #fff;
}

.price-filter-form {
    margin-top: 4px;
}

.price-inline-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.price-inline-input {
    width: 10ch;
    min-width: 10ch;
    padding: 8px 6px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    text-align: right;
}

.price-unit,
.price-separator {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

.inline-filter-btn {
    width: auto;
    padding: 8px 18px;
    border: 1px solid #555;
    border-radius: 25px;
    background-color: #555;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.inline-filter-btn:hover {
    opacity: 0.85;
}

.side-rank-item {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}

.side-rank-num {
    font-weight: bold;
    color: #ff5722;
    font-size: 14px;
}

.side-rank-img-container {
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border: 1px solid #f0f0f0;
}

.side-rank-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.side-rank-name {
    font-size: 10px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 認証・フォーム共通 */
.auth-container {
    max-width: 400px;
    margin: 40px auto;
    padding: 30px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.auth-container h2 {
    text-align: center;
    color: #4a4a4a;
    margin-bottom: 25px;
}

.index-content-area {
    width: 100%;
    padding: 10px 0 20px 0;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* 管理画面用テーブル */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #fff;
}

.admin-table th,
.admin-table td {
    border: 1px solid #eee;
    padding: 12px;
    text-align: left;
}

.admin-table th {
    background-color: #f8f9fa;
    color: #333;
}

/* バッジ類 */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.badge-admin {
    background: #f8d7da;
    color: #721c24;
}

.badge-user {
    background: #e2e3e5;
    color: #383d41;
}

.badge-pet {
    background: #e0f2f1;
    color: #00796b;
}

.badge-food {
    background: #fff3e0;
    color: #e65100;
}

.badge-prescription {
    background: #ffebee;
    color: #c62828;
}

/* ボタン類 */
.btn-toggle {
    padding: 5px 10px;
    font-size: 12px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-demote {
    background-color: #6c757d;
}

.btn-promote {
    background-color: #7d9d44;
}

.submit-btn {
    background-color: #7d9d44;
    color: white;
    border: none;
    padding: 12px;
    width: 100%;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-btn:hover {
    background-color: #6a8639;
}

/* =========================================
    6. 商品詳細ページ
   ========================================= */
.product-detail-container {
    padding: 20px 0 50px;
}

.product-header {
    margin-bottom: 30px;
    border-bottom: 2px solid #eee0c8;
    padding-bottom: 20px;
}

.brand-label {
    color: #888;
    margin: 0 0 5px 0;
    font-size: 0.9rem;
}

.product-title-detail {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-top: 5px;
    margin-bottom: 10px;
    line-height: 1.3;
}

.fav-btn-circle {
    width: 45px;
    height: 45px;
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    background-color: #fff;
}

.fav-btn-circle span {
    font-size: 22px;
    color: #ccc;
    pointer-events: none;
}

.fav-btn-circle.is-active {
    border-color: #ffcdd2;
    background-color: #fff5f5;
}

.fav-btn-circle.is-active span {
    color: #e74c3c;
}

.shop-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.shop-info {
    flex: 0 0 160px;
}

.shop-price {
    flex: 1;
    text-align: right;
}

.shop-btn-wrap {
    flex: 0 0 auto;
}

.shop-link-btn {
    background: #ff9800;
    color: white;
    padding: 10px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: bold;
    display: inline-block;
    transition: opacity 0.2s;
}

.shop-link-btn:hover {
    opacity: 0.8;
}

.request-link-btn {
    display: inline-block;
    padding: 8px 20px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 20px;
    color: #5d4037;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.request-link-btn:hover {
    background: #75AA5A;
    border-color: #75AA5A;
    color: #fff;
}

/* 商品詳細レイアウト（クラス化） */
.product-detail-body {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.product-image-col {
    flex: 0 0 300px;
}

.product-image-box {
    width: 300px;
    height: 300px;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-info-col {
    flex: 1;
}

/* タブレット（769px〜1024px） */
@media (min-width: 769px) and (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    aside.sidebar {
        flex: 0 0 200px;
    }
}

/* スマホ（〜768px） */
@media (max-width: 768px) {
    /* メインレイアウト */
    main.container {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }

    aside.sidebar {
        display: none;
    }

    /* ヘッダーナビ */
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nav-list {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* 検索エリア */
    .search-section {
        padding: 15px;
    }

    .index-content-area {
        max-width: 100%;
        padding: 10px;
    }

    /* 商品グリッド */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 商品詳細 */
    .product-detail-body {
        flex-direction: column;
        gap: 20px;
    }

    .product-image-col {
        flex: none;
        width: 100%;
    }

    .product-image-box {
        width: 100%;
        height: 220px;
    }

    /* 価格比較行 */
    .shop-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .shop-info {
        flex: 0 0 auto;
    }

    .shop-price {
        flex: 0 0 auto;
        text-align: left;
    }

    .shop-btn-wrap {
        flex: 0 0 100%;
    }

    .shop-link-btn {
        width: auto;
        text-align: left;
    }

    /* 価格フィルター */
    .price-inline-group {
        flex-wrap: wrap;
    }
}