* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}


.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 80px 20px 20px;
}

.container h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    margin-bottom: 30px;
    color: #666;
    font-size: 1.2em;
}

/* フィルターセクション */
.filter-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.search-container {
    position: relative;
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #9ca3af;
    pointer-events: none;
}

.category-filters {
    margin-bottom: 1rem;
}

.popular-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.other-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 0.5rem;
    }
}

.category-btn {
    padding: 8px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.category-btn:hover {
    border-color: #3498db;
    color: #3498db;
    transform: translateY(-1px);
}

.category-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
    transform: translateY(-1px);
}

.more-categories-btn {
    background-color: #f3f4f6 !important;
    border-color: #d1d5db !important;
    color: #6b7280 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: fit-content;
    height: auto;
}

.more-categories-btn:hover {
    background-color: #e5e7eb !important;
    border-color: #9ca3af !important;
}

.more-categories-btn .more-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.more-categories-btn:hover .more-icon {
    transform: translateY(1px);
}

.results-info {
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    font-size: 1.1rem;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px dashed #d1d5db;
}

.no-results p:first-child {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* もっと見るボタン */
.load-more-section {
    text-align: center;
    margin: 2rem 0;
    padding-top: 1rem;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
}

.load-more-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.load-more-btn:hover {
    background: linear-gradient(135deg, #2980b9, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.4);
}

.load-more-btn:hover:before {
    left: 100%;
}

.load-more-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.load-more-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.load-more-btn:hover .load-more-icon {
    transform: translateY(2px);
}

/* 管理者パネル */
.admin-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 280px;
    z-index: 1000;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
}

.admin-panel.admin-panel-visible {
    opacity: 1;
    transform: translateX(0);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.close-admin-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-admin-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-actions {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.admin-btn-icon {
    font-size: 1rem;
}

.cache-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.cache-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
}

.reload-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.reload-btn:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-1px);
}

.storage-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.storage-btn:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    transform: translateY(-1px);
}

.admin-status {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    min-height: 1.5rem;
}

.admin-status.loading {
    color: #3498db;
}

.admin-status.success {
    color: #27ae60;
}

.admin-status.error {
    color: #e74c3c;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* 関連ツールカード（トップページ用） */
.related-tool-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.related-tool-card:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
}

.related-tool-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.related-tool-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
    margin: 0;
    flex: 1;
}

.related-tool-category {
    background: #3b82f6;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.related-tool-description {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 1;
}

.related-tool-action {
    margin-top: auto;
}

.related-tool-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #3b82f6;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.related-tool-card:hover .related-tool-link {
    color: #2563eb;
}

.related-tool-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.related-tool-card:hover .related-tool-arrow {
    transform: translateX(4px);
}

/* 読み込み中とエラーメッセージ */
.loading-message, .error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    font-size: 1.1rem;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
}

@media (max-width: 768px) {
    .container {
        padding: 80px 15px 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-section {
        padding: 1.5rem;
    }
    
    .popular-categories,
    .other-categories {
        gap: 0.3rem;
    }
    
    .category-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .more-categories-btn {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
    
    .search-input {
        font-size: 0.9rem;
    }
    
    .load-more-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .load-more-icon {
        width: 18px;
        height: 18px;
    }
    
    /* 管理者パネルのモバイル対応 */
    .admin-panel {
        right: 10px;
        top: 10px;
        min-width: 260px;
    }
    
    .admin-header {
        padding: 0.75rem 1rem;
    }
    
    .admin-actions {
        padding: 0.75rem 1rem;
    }
    
    .admin-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .admin-status {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}