/**
 * 淀川の植物 - 機能用CSS
 * ブックマーク、検索、学習履歴
 */

/* ========================================
   検索機能
   ======================================== */
.search-container {
    position: relative;
    margin-bottom: 1rem;
    padding: 0;
}

#global-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    background: #fff;
    box-sizing: border-box;
    font-family: inherit;
}

#global-search:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

#global-search::placeholder {
    color: #999;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    display: block;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
    background: #f0f7f0;
}

.search-result-title {
    font-weight: 600;
    color: #1a5a1a;
    margin-bottom: 4px;
}

.search-result-title mark {
    background: #fff3cd;
    padding: 0 2px;
}

.search-result-meta {
    font-size: 0.8rem;
    color: #666;
}

.search-result-chapter {
    margin-right: 10px;
}

.search-result-keywords {
    color: #888;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
}

/* ========================================
   ブックマーク機能
   ======================================== */
.bookmark-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #ccc;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.bookmark-btn:hover {
    color: #ffc107;
    transform: scale(1.1);
}

.bookmark-btn.bookmarked {
    color: #ffc107;
}

.bookmark-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.bookmark-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ブックマーク一覧ページ */
.bookmark-group {
    margin-bottom: 25px;
}

.bookmark-chapter {
    font-size: 1rem;
    color: #2e7d32;
    border-bottom: 2px solid #2e7d32;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.bookmark-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bookmark-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.bookmark-link {
    flex: 1;
    display: flex;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
}

.bookmark-link:hover .bookmark-title {
    color: #2e7d32;
}

.bookmark-date {
    font-size: 0.8rem;
    color: #888;
}

.bookmark-remove {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 8px;
}

.bookmark-remove:hover {
    color: #e53935;
}

.no-bookmarks {
    text-align: center;
    color: #666;
    padding: 30px;
}

/* ========================================
   学習履歴ウィジェット
   ======================================== */
.review-tracker-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 240px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    font-size: 0.85rem;
    overflow: hidden;
    transition: all 0.3s;
}

.review-tracker-widget.collapsed .review-tracker-body {
    display: none;
}

.review-tracker-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, #2e7d32, #4caf50);
    color: #fff;
    cursor: pointer;
}

.review-tracker-icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

.review-tracker-title {
    flex: 1;
    font-weight: 600;
}

.review-tracker-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
}

.review-tracker-body {
    padding: 15px;
}

.review-tracker-chapter {
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.review-tracker-stat {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}

.review-tracker-stat:last-of-type {
    border-bottom: none;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 5px;
}

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

.status-badge.today {
    background: #fff3e0;
    color: #ef6c00;
}

.status-badge.soon {
    background: #e3f2fd;
    color: #1565c0;
}

.status-badge.ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge.not-started {
    background: #f5f5f5;
    color: #757575;
}

.review-tracker-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.review-tracker-link {
    color: #2e7d32;
    text-decoration: none;
    font-size: 0.8rem;
}

.review-tracker-link:hover {
    text-decoration: underline;
}

.review-tracker-clear {
    background: none;
    border: none;
    color: #999;
    font-size: 0.8rem;
    cursor: pointer;
}

.review-tracker-clear:hover {
    color: #e53935;
}

/* 学習履歴一覧ページ */
.review-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.review-history-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #ccc;
}

.review-history-card.overdue {
    border-left-color: #c62828;
}

.review-history-card.today {
    border-left-color: #ef6c00;
}

.review-history-card.soon {
    border-left-color: #1565c0;
}

.review-history-card.ok {
    border-left-color: #2e7d32;
}

.review-history-card.not-started {
    border-left-color: #bdbdbd;
    opacity: 0.7;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card-chapter {
    font-size: 0.8rem;
    color: #666;
}

.card-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a5a1a;
    text-decoration: none;
    margin-bottom: 15px;
}

.card-title:hover {
    color: #2e7d32;
}

.card-stats {
    font-size: 0.85rem;
}

.card-stat {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.not-started-text {
    text-align: center;
    color: #999;
    padding: 20px 0;
}

.card-clear {
    margin-top: 15px;
    background: none;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    color: #666;
}

.card-clear:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* ========================================
   レスポンシブ
   ======================================== */
@media screen and (max-width: 768px) {
    .review-tracker-widget {
        bottom: 10px;
        right: 10px;
        width: 220px;
    }
    
    .review-history-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 480px) {
    .review-tracker-widget {
        width: 200px;
        font-size: 0.8rem;
    }
}

/* ========================================
   アクションボタン
   ======================================== */
.bookmark-actions,
.review-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.clear-all-btn {
    background: #fff;
    border: 1px solid #e53935;
    color: #e53935;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.clear-all-btn:hover {
    background: #e53935;
    color: #fff;
}
