body {
    font-family: Arial, sans-serif;
    margin: 20px;
}

input{
    padding: 10px;
    width:30%;
}
button {
    padding: 10px;
    margin: 5px;
}

#results {
    margin-top: 20px;
    white-space: pre-wrap;
    min-height: 150px;
    max-height: 800px;
    height: 150px;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: #fff;
    resize: both; /* リサイズを許可 */
    overflow: auto; /* スクロールバーを表示 */
    min-width: 200px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.textarea-container {
    width: 100%;
    position: relative;
}

#selectedKeywords {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: both; /* リサイズを許可 */
    overflow: auto; /* スクロールバーを表示 */
    min-height: 30px;
    height: 100px;
    min-width: 200px;
    box-sizing: border-box;
}

/* リサイズハンドルを非表示に */
#results::-webkit-resizer {
    display: none;
}

/* ホバー時の視覚的なフィードバック */
#results:hover {
    cursor: row-resize;
}

.status {
    margin-top: 10px;
    color: #666;
    font-style: italic;
}

.progress-bar {
    width: 100%;
    background-color: #e0e0e0;
    padding: 3px;
    border-radius: 3px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2);
    margin-top: 10px;
    display: none;
}

.progress-bar-fill {
    height: 10px;
    background-color: #4CAF50;
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0;
}

.config-section {
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.config-item {
    margin: 10px 0;
}

label {
    display: inline-block;
    min-width: 180px;
}

.toggle-switch {
    margin: 10px 0;
}

.toggle-switch input[type="checkbox"] {
    margin-right: 5px;
}

/* グリッド表示用スタイル */
.keyword-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.keyword-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 10px;
    background-color: #f9f9f9;
    transition: background-color 0.2s;
}

.keyword-item[title] {
    cursor: help;
}

.keyword-item:hover {
    background-color: #e0e0e0;
    cursor: pointer;
}

.result-count {
    margin-bottom: 10px;
    font-weight: bold;
}

.textarea-section {
    margin-top: 20px;
}

.textarea-controls {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.byte-counter {
    font-size: 14px;
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.byte-counter.over-limit {
    color: #ff0000;
    font-weight: bold;
}

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

.text-buttons button {
    padding: 5px 10px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.text-buttons button:hover {
    background-color: #e0e0e0;
}

.byte-example {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.byte-counts {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
}

.line-count {
    font-size: 13px;
    padding: 4px 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
    color: #333;
}

.line-count.over-limit {
    background-color: #fff0f0;
    color: #ff0000;
    font-weight: bold;
}

#byteCounter.over-limit {
    background-color: #fff0f0;
    color: #ff0000;
}

.has-over-limit {
    border: 1px solid #ff0000;
    padding: 8px;
    border-radius: 4px;
}

.secondary-button {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    padding: 4px 8px;
    margin: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.secondary-button:hover {
    background-color: #e0e0e0;
}

.secondary-button:disabled {
    background-color: #f8f8f8;
    color: #999;
    cursor: not-allowed;
}

.secondary-select {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    padding: 4px 8px;
    margin: 4px;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
}

.secondary-select:hover {
    background-color: #e0e0e0;
}

/* キーワード管理セクション（横並び） */
.keyword-management-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.forbidden-keywords-section,
.exact-keywords-section,
.save-keywords-section {
    flex: 1;
    min-width: 300px; /* 最小幅を設定 */
}

.forbidden-keywords-section {
    padding: 15px;
    background-color: #fff3f3;
    border-radius: 5px;
}

.exact-keywords-section {
    padding: 15px;
    background-color: #f0f7ff;
    border-radius: 5px;
}

.save-keywords-section {
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 5px;
}

/* 保存セクションのレイアウト調整 */
.save-keywords-container {
    margin-top: 0;
    padding: 0;
    background-color: transparent;
    width: 100%;
}

.save-keywords-input {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.save-keywords-input input {
    flex: 1;
    min-width: 0; /* flexbox内での収縮を許可 */
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.load-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.load-keywords select {
    flex: 1;
    min-width: 200px; /* セレクトボックスの最小幅 */
}

.load-keywords button {
    white-space: nowrap; /* ボタンのテキストを折り返さない */
}

/* レスポンシブ対応を更新 */
@media (max-width: 768px) {
    .keyword-management-container {
        flex-direction: column;
    }
    
    .forbidden-keywords-section,
    .exact-keywords-section,
    .save-keywords-section {
        width: 100%;
        min-width: 0;
    }

    .load-keywords {
        flex-direction: column;
    }

    .load-keywords select,
    .load-keywords button {
        width: 100%;
        flex: 1;
    }
}

.help-text {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.save-keywords-container {
    margin-top: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
    width:98%;
}

.save-keywords-input {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.save-keywords-input input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.load-keywords {
    display: flex;
    gap: 10px;
}

.load-keywords select {
    flex: 1;
}

.delete-button {
    background-color: #fff0f0;
}

.delete-button:hover {
    background-color: #ffe0e0;
}

.textarea-container textarea {
    width:90%;
}

.extra-lines-count {
    margin: 2px 0;
    background-color: #f0f8ff;
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #4c8bf5;
}

/* 新しいサジェスト表示用のスタイル */
.result-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.result-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.search-filter-box {
    margin: 10px 0 20px;
    position: relative;
}

.search-filter-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.search-tip {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.tab-container {
    margin: 15px 0;
}

.tabs {
    display: flex;
    gap: 5px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.tab {
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    background-color: #f5f5f5;
    transition: all 0.2s;
}

.tab:hover {
    background-color: #e0e0e0;
}

.tab.active {
    background-color: #4CAF50;
    color: white;
    font-weight: bold;
}

.view-container {
    min-height: 300px;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
}

/* グリッド表示 */
.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

/* リスト表示 */
.list-view {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.keyword-group {
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px;
    min-width: 200px;
    flex: 1;
}

.keyword-group h4 {
    margin: 0 0 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    color: #444;
    font-size: 14px;
}

.keywords-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 5px;
}

.keyword-list-item {
    padding: 5px 8px;
    border: 1px solid #eee;
    border-radius: 3px;
    background-color: #f9f9f9;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.keyword-list-item:hover {
    background-color: #e0e0e0;
}

/* タグクラウド */
.cloud-view {
    padding: 15px;
    line-height: 1.8;
    text-align: center;
}

.tag-item {
    display: inline-block;
    margin: 3px 5px;
    padding: 0 5px;
    cursor: pointer;
    transition: transform 0.2s;
}

.tag-item:hover {
    transform: scale(1.1);
    text-decoration: underline;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        flex-basis: calc(33.33% - 5px);
        text-align: center;
    }
    
    .keyword-group {
        min-width: 100%;
    }
}

/* コピーボタンとフィードバック関連のスタイル */
.result-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 5px;
}

.copy-all-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.copy-all-btn:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.copy-all-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.copy-icon {
    font-size: 16px;
}

.copy-feedback {
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-height: 20px;
    margin-bottom: 10px;
}

.copy-feedback.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-left: 3px solid #2e7d32;
}

.copy-feedback.error {
    background-color: #ffebee;
    color: #c62828;
    border-left: 3px solid #c62828;
}

/* アニメーション効果 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* コピーボタン関連のスタイル強化版 */
.result-header-top {
    margin-bottom: 15px;
}

.copy-button-container {
    margin: 15px 0;
    text-align: center;
}

.copy-all-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.copy-all-btn:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.copy-all-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.copy-icon {
    font-size: 18px;
}