/**
 * Keyword Suggester Pro - Final Integrated Stylesheet
 * Base Color: #46757e
 */

/* 1. 全体コンテナと基本レイアウト */
.ks-container {
    background: #ffffff;
    padding: 30px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin: 20px 0;
    color: #334155;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    line-height: 1.6;
    max-width: 100%;
    box-sizing: border-box;
}

.ks-header {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.4rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.ks-header::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 24px;
    background: #46757e;
    border-radius: 3px;
}

/* 2. 使用状況バッジ（権限別） */
.ks-usage-badge {
    display: inline-block;
    background: #f1f5f9;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    color: #46757e;
    border: 1px solid #cbd5e1;
    margin-bottom: 20px;
}

.role-admin .ks-usage-badge {
    background: #46757e;
    color: #ffffff;
    border-color: #365b62;
}

.ks-usage-badge strong {
    font-size: 1.1em;
}

/* 3. 入力・フィルタセクション */
.ks-input-group {
    margin-bottom: 15px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ks-input {
    flex: 1;
    min-width: 280px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.ks-input:focus {
    border-color: #46757e;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(70, 117, 126, 0.1);
    outline: none;
}

.ks-filter-group {
    background: #f8fafc;
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.ks-filter-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #475569;
}

.ks-filter-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    background: #ffffff;
}

/* 4. 進捗演出（プログレスバー） */
.ks-progress-container {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
    display: none;
}

.ks-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #46757e, #6ba1aa);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ks-status {
    font-size: 14px;
    font-weight: 600;
    margin: 15px 0;
    padding: 14px 18px;
    border-radius: 8px;
    background: #f8fafc;
    border-left: 5px solid #46757e;
    color: #475569;
}

/* エラー時の警告 */
.ks-status.error {
    background: #fff1f2;
    border-left-color: #e11d48;
    color: #9f1239;
    animation: ks-shake 0.5s ease-in-out;
}

@keyframes ks-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 5. ボタンデザイン */
.ks-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.ks-btn-primary {
    background: #46757e;
    color: #ffffff;
}

.ks-btn-primary:hover {
    background: #365b62;
    box-shadow: 0 4px 12px rgba(70, 117, 126, 0.25);
}

.ks-btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.ks-btn-secondary {
    background: #ffffff;
    color: #46757e;
    border: 2px solid #46757e;
}

.ks-btn-secondary:hover {
    background: #f0f4f5;
}

/* 6. 需要予測バッジ & キーワード一覧 */
.ks-vol-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 10px;
    vertical-align: middle;
}

.vol-high { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.vol-mid { background: #fef3c7; color: #d97706; border: 1px solid #fcd34d; }
.vol-low { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.ks-keyword-item {
    display: block;
    padding: 6px 0;
    border-bottom: 1px dashed #f1f5f9;
}

.ks-keyword-item:last-child {
    border-bottom: none;
}

/* 7. 結果テーブルエリア */
.ks-result-area {
    margin-top: 25px;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.ks-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.ks-table th, .ks-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.ks-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 2px solid #e2e8f0;
}

.ks-table tr:hover td {
    background: #fcfdfe;
}

.ks-table td strong {
    color: #46757e;
    font-weight: 700;
}

/* カスタムスクロールバー (Chrome/Safari) */
.ks-result-area::-webkit-scrollbar {
    width: 8px;
}
.ks-result-area::-webkit-scrollbar-track {
    background: #f8fafc;
}
.ks-result-area::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    border: 2px solid #f8fafc;
}