/* ========================================
   本棚画面専用スタイル
   ======================================== */

/* コントロールセクション */
.controls {
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 検索バー */
.search-container {
    display: flex;
    flex-direction: column;
    min-width: 160px;
    height: 44px;
    width: 100%;
}

.search-wrapper {
    display: flex;
    width: 100%;
    flex: 1;
    align-items: stretch;
    border-radius: 8px;
    height: 100%;
    overflow: hidden;
}

.search-icon-wrapper {
    color: #8b735b;
    display: flex;
    background-color: rgba(255, 255, 255, 0.6);
    align-items: center;
    justify-content: center;
    padding-left: 16px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.search-icon-wrapper .material-symbols-outlined {
    font-size: 20px;
}

.search-input {
    display: flex;
    width: 100%;
    min-width: 0;
    flex: 1;
    resize: none;
    overflow: hidden;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    color: #2c1e1a;
    border: none;
    background-color: rgba(255, 255, 255, 0.6);
    height: 100%;
    padding: 0 16px 0 8px;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    font-family: 'Noto Sans JP', sans-serif;
}

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

.search-input::placeholder {
    color: #8b735b;
}

/* フィルターチップ */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    display: flex;
    height: 32px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #e5dcc5;
    padding: 0 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background-color: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chip-text {
    color: #2c1e1a;
    font-size: 0.75rem;
    font-weight: 600;
}

.chip-arrow {
    font-size: 0.875rem;
    color: #2c1e1a;
}

/* 新規登録ボタン */
.add-button-container {
    display: flex;
    padding: 4px 0;
}

.btn-add-book {
    display: flex;
    min-width: 84px;
    width: 100%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    height: 48px;
    padding: 0 20px;
    background-color: #D4AF37;
    color: white;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
    transition: transform 0.1s;
}

.btn-add-book:active {
    transform: scale(0.98);
}

.btn-add-book .material-symbols-outlined {
    font-size: 24px;
}

.btn-text {
    font-weight: 700;
    letter-spacing: 0.02em;
    font-size: 0.9375rem;
}

/* ========================================
   メインコンテンツ
   ======================================== */

.main-content {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

/* 本棚の行 */
.shelf-row {
    position: relative;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 32px;
    row-gap: 0;
    position: relative;
    z-index: 10;
    padding: 0 8px;
}

/* 本のカード */
.book-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.book-card:hover {
    transform: translateY(-4px);
}

.book-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: -4px;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.3), 1px 0 2px rgba(0, 0, 0, 0.2);
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 評価バッジ */
.rating-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.star-icon {
    color: #fbbf24;
    font-size: 10px;
    font-variation-settings: 'FILL' 1;
}

.rating-text {
    color: white;
    font-size: 10px;
    font-weight: 700;
}

/* ステータスバッジ */
.status-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
}

.status-completed {
    background-color: #11d452;
}

.status-reading {
    background-color: #eab308;
}

.status-stacked {
    background-color: #9ca3af;
}

.status-icon {
    color: white;
    font-size: 12px;
    font-weight: 700;
}

/* ジャンルタグ */
.genre-tag-container {
    margin-top: 16px;
    width: 100%;
    text-align: center;
}

.genre-tag {
    display: inline-block;
    padding: 2px 8px;
    background-color: #f5f0e1;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    color: #5d4037;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #e5dcc5;
}

/* 木製の棚 */
.wood-shelf {
    background: linear-gradient(180deg, #8d6e63 0%, #5d4037 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
    height: 12px;
    width: 100%;
    border-radius: 2px;
    margin-top: 4px;
}

/* ========================================
   モーダル（本の詳細）
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal-overlay.active {
    display: flex;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 430px;
    height: 92vh;
    background-color: #ffffff;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* モーダルヘッダー */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    position: sticky;
    top: 0;
    background-color: #ffffff;
    z-index: 20;
    border-bottom: 1px solid #f3f4f6;
}

.modal-handle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 8px;
    width: 40px;
    height: 4px;
    background-color: #d1d5db;
    border-radius: 9999px;
}

.modal-title {
    color: #2c1e1a;
    font-size: 1.125rem;
    font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif;
}

.btn-close-modal {
    padding: 8px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-close-modal:hover {
    background-color: #f3f4f6;
}

.btn-close-modal .material-symbols-outlined {
    color: #6b7280;
    font-size: 24px;
}

/* モーダルボディ */
.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 96px;
}

/* 本の詳細ヘッダー */
.book-detail-header {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.book-detail-cover-wrapper {
    width: 100%;
    flex-shrink: 0;
}

.book-detail-cover {
    aspect-ratio: 2/3;
    width: 160px;
    margin: 0 auto;
    background-color: #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    background-size: cover;
    background-position: center;
}

.book-detail-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.book-detail-title {
    color: #2c1e1a;
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
    font-family: 'Noto Serif JP', serif;
}

.book-detail-author {
    color: #6b7280;
    font-size: 1.125rem;
    font-weight: 500;
}

/* 評価の星 */
.book-detail-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 0;
}

.star-filled {
    color: #FFD700;
    font-size: 20px;
    font-variation-settings: 'FILL' 1;
}

.star-half {
    color: #FFD700;
    font-size: 20px;
}

.rating-number {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-left: 8px;
    font-family: 'Noto Sans JP', sans-serif;
}

/* ジャンルタグ（詳細） */
.book-detail-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding-top: 4px;
}

.detail-tag {
    display: flex;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background-color: #f3f4f6;
    padding: 0 12px;
}

.detail-tag-text {
    color: #374151;
    font-size: 0.75rem;
    font-weight: 600;
}

.detail-tag-status {
    display: flex;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background-color: rgba(17, 212, 82, 0.2);
    padding: 0 12px;
}

.detail-tag-status-text {
    color: #11d452;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* 統計情報 */
.book-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid #f3f4f6;
    border-bottom: 1px solid #f3f4f6;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    font-weight: 700;
}

.stat-value {
    color: #2c1e1a;
    font-weight: 500;
}

/* メモ・感想セクション */
.book-notes-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notes-title {
    color: #2c1e1a;
    font-weight: 700;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notes-title .material-symbols-outlined {
    color: #9ca3af;
    font-size: 20px;
}

.notes-content {
    background-color: #f6f8f6;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
}

.notes-text {
    color: #4b5563;
    line-height: 1.6;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.875rem;
    font-style: italic;
}

/* モーダルフッター */
.modal-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 12px;
}

.btn-edit-book {
    flex: 1;
    background-color: #11d452;
    color: white;
    font-weight: 700;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 10px 15px -3px rgba(17, 212, 82, 0.2);
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-edit-book:active {
    transform: scale(0.95);
}

.btn-edit-book .material-symbols-outlined {
    font-size: 20px;
}

.btn-delete-book {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background-color: #fef2f2;
    color: #dc2626;
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-delete-book:active {
    transform: scale(0.95);
}

.btn-delete-book .material-symbols-outlined {
    font-size: 24px;
}
