/* コンポーネントスタイル */

/* 検索セクション */
.search-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 1.1rem;
}

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

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.filter-btn:hover {
    background: #f5f5f5;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* コマンドグリッド */
.commands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.command-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid #667eea;
}

.command-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

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

.command-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.command-category {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

.command-code {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #d63384;
    margin-bottom: 10px;
    word-break: break-all;
}

.command-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.command-actions {
    display: flex;
    gap: 10px;
}

/* ボタンスタイル */
.btn-copy {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-copy:hover {
    background: #218838;
}

.btn-param {
    background: #ffc107;
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-param:hover {
    background: #e0a800;
}

.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s ease;
}

.btn-delete:hover {
    background: #c82333;
}

/* 通知 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

/* iPhone / スマートフォン対応改善 */
@media (max-width: 480px) {
    /* 検索セクション */
    .search-section {
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 10px;
    }
    
    .search-box input {
        padding: 14px 45px;
        font-size: 16px; /* iOSズーム防止 */
        border-radius: 10px;
    }
    
    .search-box i {
        font-size: 1rem;
        left: 12px;
    }
    
    /* フィルターボタン */
    .filter-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
        border-radius: 15px;
        min-height: 44px; /* タッチ操作に適したサイズ */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* コマンドグリッド */
    .commands-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .command-card {
        padding: 16px;
        border-radius: 10px;
        border-left-width: 3px;
    }
    
    .command-title {
        font-size: 1rem;
        line-height: 1.4;
        /* 長いタイトルの省略表示 */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .command-description {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 12px;
    }
    
    .command-code {
        font-size: 0.8rem;
        padding: 10px 12px;
        border-radius: 6px;
        /* 長いコードの水平スクロール */
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    /* ボタン */
    .btn-copy,
    .btn-param {
        padding: 10px 16px;
        font-size: 0.85rem;
        min-height: 44px;
        border-radius: 8px;
        /* タッチ操作の改善 */
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    .btn-primary {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    .btn-secondary {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 0.85rem;
        border-radius: 8px;
    }
    
    /* カテゴリータグ */
    .command-category {
        font-size: 0.75rem;
        padding: 4px 8px;
        border-radius: 10px;
    }
    
    /* コマンドアクション */
    .command-actions {
        gap: 8px;
        margin-top: 12px;
    }
    
    /* 横スクロール改善 */
    .filter-buttons {
        gap: 8px;
        padding-bottom: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* スクロールバーを隠す */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .filter-buttons::-webkit-scrollbar {
        display: none;
    }
    
    /* フレックスボックスの調整 */
    .filter-buttons {
        flex-wrap: nowrap;
        min-width: min-content;
    }
    
    .filter-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

/* iPhone SE / 小画面対応 */
@media (max-width: 375px) {
    .search-box input {
        padding: 12px 40px;
        font-size: 16px;
    }
    
    .search-box i {
        left: 10px;
        font-size: 0.9rem;
    }
    
    .command-card {
        padding: 14px;
    }
    
    .command-title {
        font-size: 0.95rem;
    }
    
    .command-description {
        font-size: 0.8rem;
    }
    
    .command-code {
        font-size: 0.75rem;
        padding: 8px 10px;
    }
    
    .btn-copy,
    .btn-param,
    .btn-primary,
    .btn-secondary {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-height: 40px;
    }
    
    .filter-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-height: 40px;
    }
}

/* タッチ操作の改善 */
@media (hover: none) and (pointer: coarse) {
    /* ホバー効果をタッチ用に調整 */
    .command-card:hover {
        transform: none;
    }
    
    .command-card:active {
        transform: translateY(-2px);
        transition: transform 0.1s ease;
    }
    
    .filter-btn:hover {
        background: white;
    }
    
    .filter-btn:active {
        background: #f0f0f0;
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
    
    .btn-copy:active,
    .btn-param:active,
    .btn-primary:active,
    .btn-secondary:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}
