/* 検索機能のスタイル */
.top .search-container {
    margin-left: auto;
    display: flex;
    width: 280px;
}


#search-input {
    flex-grow: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px 0 0 8px;
    font-size: 14px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

#search-button {
    padding: 8px 12px;
    background-color: #3498db;
    border: none;
    color: white;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

#search-button:hover {
    background-color: #2980b9;
}
/* 検索オーバーレイ */
/* 背景スクロール防止用 */
body.no-scroll {
    overflow: hidden;
}

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.search-overlay.visible {
    opacity: 1;
    transform: translateY(0);
}
.search-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
}

.back-button {
    background: none;
    border: none;
    font-size: 16px;
    color: #3498db;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 4px;
    margin-right: 15px;
}

.back-button:hover {
    background-color: #f0f0f0;
}

.search-header h2 {
    margin: 0;
    font-size: 18px;
    flex-grow: 1;
}

.search-results {
    padding: 15px;
    flex-grow: 1;
}

.result-item {
    margin-bottom: 12px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.result-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.result-type {
    display: inline-block;
    padding: 3px 8px;
    background-color: #e9f0f8;
    border-radius: 12px;
    font-size: 12px;
    color: #3498db;
}

.result-author {
    font-size: 13px;
    color: #7f8c8d;
    margin-top: 8px;
}

.no-results {
    text-align: center;
    color: #7f8c8d;
    padding: 40px;
    font-size: 16px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
    font-size: 16px;
}

@media screen and (max-width: 767px) {
    .top .search-container {
        width: 100%;
        margin-top: 10px;
        order: 3;
    }
    
    .top {
        flex-wrap: wrap;
    }
    
    .search-header h2 {
        font-size: 16px;
    }
    
    .back-button {
        font-size: 14px;
    }
}

body {
    font-family: 'Noto Sans Japanese', sans-serif;
    background-color: #ebedf1;
    margin: 0;
    padding: 0;
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #fbfbfb;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 2;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.main {
    position: relative;
    width: 95%;
    margin: 15px auto;
    padding: 15px 0;
    border-radius: 6px;
    background-color: #fbfbfb;
    box-shadow: 7px 7px 21px -16px rgba(0, 0, 0, 0.1);
    transform: none;
    left: auto;
    height: auto;
}

.box1 {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0 auto;
    padding: 0 10px;
}

.icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

.create-btn {
    background-color: #3498db;
    color: white;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.create-btn:hover,
.create-btn:active {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.chart {
    width: 90%;
    max-width: 600px;
    margin: 0 auto;
}

.filter-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin: 15px 0;
    gap: 5px;
}

.filter-btn {
    background-color: #f0f2f5;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.filter-btn:hover {
    background-color: #e0e2e5;
}

.filter-btn.active {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

.category {
    width: 100%;
    max-width: 500px;
    margin: 15px 10px;
    padding: 0 5px;
}

.category-book {
    width: 92%;
    margin: 20px 10px;
    padding: 15px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.category-book p {
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
    color: #2c3e50;
}

.category-book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.category-book a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    text-align: center;
}

.category-book a:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: #f0f2f5;
}

.category-book img.book {
    width: 100%;
    max-width: 120px;
    height: 180px;
    margin-top: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    object-fit: cover;
    object-position: center;
}

.category-book a:hover img.book {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

@media screen and (max-width: 767px) {
    .category-book-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .category-book img.book {
        max-width: 100px;
        height: 140px; /* スマホ用に高さを調整 */
    }
}

.category p {
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid #3498db;
}

.category a {
    display: block;
    padding: 12px 15px;
    margin: 8px 0;
    background: #f5f7fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    text-align: left;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.category a:hover,
.category a:active {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}


/* Modal improvements */
.modal__container {
    max-width: 95%;
    padding: 15px;
}

.modal__content {
    padding: 10px;
}

.modal__btn {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* Responsive design improvements */
@media screen and (min-width: 1200px) {
    .box1 {
        width: 80%;
    }

    .category {
        width: 30%;
    }
}

@media screen and (min-width: 768px) and (max-width: 1199px) {
    .category {
        width: 45%;
    }
}

@media screen and (max-width: 767px) {
    .main {
        width: 100%;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .category {
        width: 100%;
        margin: 10px 0;
    }

    .filter-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .category p {
        font-size: 16px;
    }

    .category a {
        padding: 10px;
        margin: 6px 0;
    }

    .chart {
        width: 100%;
    }

    .create-btn {
        font-size: 14px;
        padding: 6px 12px;
    }
}

/* 進捗バーのスタイル */
.progress-container {
    height: 6px;
    width: 100%;
    background-color: #f0f0f0;
    border-radius: 3px;
    margin-top: 4px;
    margin-bottom: 10px;
    display: flex;
    overflow: hidden;
}

/* 書籍折りたたみ機能 */
@media screen and (max-width: 1000px) {
    .collapsible-item {
        display: none;
    }
    
    .toggle-book {
        display: block;
        margin-top: 10px;
        padding: 7px 16px;
        background-color: #3498db;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 14px;
        transition: background-color 0.3s;
        width: 100%;
        text-align: center;
    }
    
    .toggle-book:hover {
        background-color: #2980b9;
    }
    
    .category-book.expanded .collapsible-item {
        display: block;
    }
}

.progress-learned {
    background: linear-gradient(90deg, #4caf50,90%, #ff9800);
    /* 緑色 - 学習済み */
    height: 100%;
}

.progress-learned[title*="100.0%"] {
    background: #4caf50;
}

.progress-learning {
    background: #ff9800;
    /* オレンジ色 - 学習中 */
    height: 100%;
}

.progress-unlearned {
    background-color: #e0e0e0;
    /* グレー - 未学習 */
    height: 100%;
}