/**
 * Rank Checker Pro - Integrated Stylesheet
 * Base Color: #46757e (Deep Teal)
 */

/* 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;
}

/* 3. 入力セクション (Rank Checker用調整) */
.ks-filter-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #475569;
}

/* テキストエリアと入力フィールド */
.ks-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f8fafc;
    box-sizing: border-box;
    font-family: inherit;
}

/* URL入力欄などは等幅フォントの方が見やすい場合 */
textarea.ks-input {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    line-height: 1.4;
    resize: vertical;
}

.ks-input:focus {
    border-color: #46757e;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(70, 117, 126, 0.1);
    outline: none;
}

/* 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;
    margin-right: 8px;
    margin-bottom: 8px;
}

.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;
}

/* 6. 順位表示バッジ (Rank Checker用) */
.ks-vol-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    min-width: 80px;
}

/* 10位以内（上位） */
.vol-high { 
    background: #dcfce7; 
    color: #166534; 
    border: 1px solid #bbf7d0; 
}
/* 11位〜30位（中位） */
.vol-mid { 
    background: #fef3c7; 
    color: #d97706; 
    border: 1px solid #fcd34d; 
}
/* 31位〜 または 圏外 */
.vol-low { 
    background: #f1f5f9; 
    color: #64748b; 
    border: 1px solid #e2e8f0; 
}

/* 7. 結果テーブルエリア */
.ks-result-area {
    margin-top: 25px;
    max-height: 600px;
    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;
    word-wrap: break-word;
}

.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;
}

/* モバイル対応の調整 */
@media (max-width: 600px) {
    .ks-table th:nth-child(2), 
    .ks-table td:nth-child(2) {
        display: none; /* スマホではURLを隠してキーワードと順位のみにする例 */
    }
    .ks-table th, .ks-table td {
        padding: 10px;
    }
}