/**
 * AI Article Generator - 管理画面スタイル
 */

/* ===== 基本レイアウト ===== */
.aagl-admin-page {
    margin-right: 20px;
}

.aagl-page-title {
    color: #23282d;
    font-size: 23px;
    font-weight: 400;
    margin: 0 0 8px;
    line-height: 29px;
}

.aagl-page-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* ===== ダッシュボードスタイル ===== */
.aagl-dashboard {
    margin-top: 20px;
}

.aagl-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.aagl-stat-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.aagl-stat-card:hover {
    border-color: #999;
}

.aagl-stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #23282d;
    line-height: 1.2;
    margin-bottom: 8px;
}

.aagl-stat-keywords .aagl-stat-number { color: #0073aa; }
.aagl-stat-sub-keywords .aagl-stat-number { color: #00a32a; }
.aagl-stat-daily .aagl-stat-number { color: #2271b1; }
.aagl-stat-monthly .aagl-stat-number { color: #9b59b6; }
.aagl-stat-articles .aagl-stat-number { color: #d63638; }
.aagl-stat-status .aagl-stat-number { color: #8c8f94; }

.aagl-stat-limit {
    font-size: 18px;
    font-weight: normal;
    color: #8c8f94;
}

.aagl-stat-label {
    font-size: 14px;
    color: #646970;
    font-weight: 500;
}

.aagl-dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.aagl-dashboard-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.aagl-dashboard-widget {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 0;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.aagl-dashboard-widget h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f1;
    background: #f9f9f9;
}

.aagl-dashboard-widget .aagl-widget-content {
    padding: 15px 20px;
}

.aagl-quick-actions {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aagl-action-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.aagl-action-button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.aagl-button-primary {
    background: #2271b1;
    color: #fff;
    border: 1px solid #2271b1;
}

.aagl-button-primary:hover {
    background: #135e96;
    color: #fff;
}

.aagl-button-secondary {
    background: #f6f7f7;
    color: #2c3338;
    border: 1px solid #c3c4c7;
}

.aagl-button-secondary:hover {
    background: #f0f0f1;
    color: #2c3338;
}

.aagl-button-tertiary {
    background: #fff;
    color: #2271b1;
    border: 1px solid #2271b1;
}

.aagl-button-tertiary:hover {
    background: #f0f6fc;
    color: #135e96;
}

/* ===== 設定ステータス ===== */
.aagl-setting-status,
.aagl-system-info {
    padding: 15px 20px;
}

.aagl-setting-item,
.aagl-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
}

.aagl-setting-item:last-child,
.aagl-info-item:last-child {
    border-bottom: none;
}

.aagl-setting-label,
.aagl-info-label {
    font-weight: 500;
    color: #1d2327;
}

.aagl-setting-value,
.aagl-info-value {
    font-size: 14px;
    color: #646970;
}

.aagl-status-configured {
    color: #00a32a;
    font-weight: 500;
}

.aagl-status-not-configured {
    color: #d63638;
    font-weight: 500;
}

.aagl-status-ok {
    color: #00a32a;
    font-weight: bold;
}

.aagl-status-error {
    color: #d63638;
    font-weight: bold;
}

/* ===== 最近の活動リスト ===== */
.aagl-recent-list {
    margin: 0;
    padding: 15px 20px;
    list-style: none;
}

.aagl-recent-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
}

.aagl-recent-list li:last-child {
    border-bottom: none;
}

.aagl-keyword {
    font-weight: 500;
    color: #1d2327;
}

.aagl-date {
    font-size: 12px;
    color: #8c8f94;
}

.aagl-no-data {
    padding: 15px 20px;
    color: #8c8f94;
    font-style: italic;
}

.aagl-widget-footer {
    padding: 10px 20px;
    border-top: 1px solid #f0f0f1;
    background: #f9f9f9;
}

.aagl-widget-footer a {
    font-size: 13px;
    text-decoration: none;
}

/* ===== 設定ページスタイル ===== */
.aagl-settings-form {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    margin-top: 20px;
}

.aagl-settings-sections {
    padding: 0;
}

.aagl-settings-section {
    border-bottom: 1px solid #f0f0f1;
    padding: 30px;
}

.aagl-settings-section:last-child {
    border-bottom: none;
}

.aagl-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aagl-section-title .dashicons {
    font-size: 20px;
    color: #2271b1;
}

.aagl-section-description {
    color: #646970;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.4;
}

/* APIキー入力フィールド */
.aagl-api-key-input {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.aagl-api-key-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.aagl-test-api-btn {
    white-space: nowrap;
}

.aagl-api-test-result {
    margin-top: 6px;
    font-size: 13px;
}

.aagl-test-success {
    color: #00a32a;
    font-weight: 500;
}

.aagl-test-error {
    color: #d63638;
    font-weight: 500;
}

.aagl-api-status {
    font-size: 13px;
    margin-top: 5px;
}

/* スライダー */
input[type="range"] {
    width: 200px;
    margin-right: 10px;
}

#temperature_value {
    font-weight: bold;
    color: #2271b1;
    min-width: 30px;
    display: inline-block;
}

/* ===== レスポンシブ対応 ===== */
@media screen and (max-width: 782px) {
    .aagl-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .aagl-dashboard-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .aagl-stat-number {
        font-size: 24px;
    }
    
    .aagl-action-button {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .aagl-settings-section {
        padding: 20px;
    }
}

@media screen and (max-width: 480px) {
    .aagl-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .aagl-setting-item,
    .aagl-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .aagl-recent-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ===== 通知とアラート ===== */
.aagl-notice {
    margin: 15px 0;
    padding: 12px;
    border-left: 4px solid transparent;
    background: #fff;
}

.aagl-notice.aagl-notice-success {
    border-left-color: #00a32a;
    background: #f0f6fc;
}

.aagl-notice.aagl-notice-error {
    border-left-color: #d63638;
    background: #fcf2f3;
}

.aagl-notice.aagl-notice-warning {
    border-left-color: #dba617;
    background: #fcf9e8;
}

.aagl-notice.aagl-notice-info {
    border-left-color: #72aee6;
    background: #f0f6fc;
}

/* ===== アニメーション ===== */
.aagl-fade-in {
    animation: aaglFadeIn 0.3s ease;
}

@keyframes aaglFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== その他のユーティリティ ===== */
.aagl-text-center { text-align: center; }
.aagl-text-right { text-align: right; }
.aagl-hidden { display: none; }
.aagl-show { display: block; }

.aagl-margin-top { margin-top: 20px; }
.aagl-margin-bottom { margin-bottom: 20px; }
.aagl-padding { padding: 15px; }

.aagl-color-success { color: #00a32a; }
.aagl-color-error { color: #d63638; }
.aagl-color-warning { color: #dba617; }
.aagl-color-info { color: #2271b1; }

/* ===== キーワード管理追加スタイル ===== */
/* WordPressデフォルトスピナーを非表示 */
.aagl-keywords-page .spinner {
    display: none !important;
}

/* 必要なフィールドマーカー */
.required {
    color: #dc3232;
    font-weight: bold;
}

/* タブパネル */
.aagl-tab-panel {
    display: none;
    padding: 20px;
    background: white;
    border: 1px solid #ccd0d4;
    border-top: none;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.aagl-tab-panel.active {
    display: block;
}

.aagl-tabs .nav-tab-wrapper {
    margin-bottom: 0;
    border-bottom: 1px solid #ccd0d4;
}

.aagl-keywords-page .nav-tab {
    cursor: pointer;
}

/* モーダル */
.aagl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    animation: aaglFadeIn 0.2s ease;
}

.aagl-modal {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    animation: aaglModalSlide 0.3s ease;
}

@keyframes aaglModalSlide {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.aagl-modal h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #23282d;
    font-size: 18px;
    font-weight: 600;
}

.aagl-modal .form-field {
    margin-bottom: 15px;
}

.aagl-modal .form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #23282d;
    font-size: 14px;
}

.aagl-modal .form-field input[type="text"],
.aagl-modal .form-field select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
}

.modal-buttons {
    margin-top: 20px;
    text-align: right;
    padding-top: 15px;
    border-top: 1px solid #dcdcde;
}

.modal-buttons button {
    margin-left: 10px;
}

/* ローディングオーバーレイ */
.aagl-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.aagl-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 999;
}

.aagl-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #0073aa;
    border-radius: 50%;
    border-top-color: transparent;
    animation: aaglSpin 1s linear infinite;
    z-index: 1000;
}

@keyframes aaglSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ステータスバッジ */
.status-badge {
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.status-badge.status-active {
    background: #7ad03a;
    color: white;
}

.status-badge.status-inactive {
    background: #999;
    color: white;
}

/* ソート可能なヘッダー */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px !important;
    transition: color 0.2s;
}

th.sortable:hover {
    color: #0073aa;
    background-color: #f1f1f1;
}

th.sortable .sorting-indicators {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-block;
    width: 16px;
    height: 16px;
}

th.sortable .sorting-indicator {
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    opacity: 0.3;
    position: absolute;
}

th.sortable .sorting-indicator.asc {
    border-width: 0 4px 6px 4px;
    border-color: transparent transparent #666 transparent;
    top: 1px;
}

th.sortable .sorting-indicator.desc {
    border-width: 6px 4px 0 4px;
    border-color: #666 transparent transparent transparent;
    bottom: 1px;
}

th.sortable.asc .sorting-indicator.asc,
th.sortable.desc .sorting-indicator.desc {
    opacity: 1;
    border-bottom-color: #0073aa;
    border-top-color: #0073aa;
}

/* エラー状態のフィールド */
input.error,
select.error,
textarea.error {
    border-color: #dc3232 !important;
    box-shadow: 0 0 2px rgba(220, 50, 50, 0.5);
    background-color: #fff5f5;
}

/* ツールチップ */
.aagl-tooltip-popup {
    position: absolute;
    background: #23282d;
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 999999;
    pointer-events: none;
}

.aagl-tooltip-popup::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #23282d transparent transparent transparent;
}

/* ===== モーダルスタイル ===== */
.aagl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: aagl-modal-fade-in 0.3s ease-out;
}

.aagl-modal {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: aagl-modal-slide-in 0.3s ease-out;
}

.aagl-modal-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    position: relative;
}

.aagl-modal-header h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #23282d;
}

.aagl-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aagl-modal-close:hover {
    color: #000;
    background: #f0f0f0;
    border-radius: 50%;
}

.aagl-modal .form-table {
    margin: 0 20px;
}

.aagl-modal-footer {
    padding: 20px;
    border-top: 1px solid #ddd;
    text-align: right;
    background: #f9f9f9;
}

.aagl-modal-footer .button {
    margin-left: 10px;
}

/* モーダルアニメーション */
@keyframes aagl-modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes aagl-modal-slide-in {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 編集ボタンスタイル */
.edit-main-keyword-btn,
.edit-sub-keyword-btn {
    margin-right: 5px;
}

.edit-main-keyword-btn:before,
.edit-sub-keyword-btn:before {
    content: "464";
    font-family: dashicons;
    margin-right: 3px;
}

/* 操作ボタン列の幅調整 */
.wp-list-table td:last-child {
    white-space: nowrap;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .aagl-modal {
        width: 95%;
        margin: 20px;
    }
    
    .aagl-modal-header,
    .aagl-modal-footer {
        padding: 15px;
    }
    
    .aagl-modal .form-table {
        margin: 0 15px;
    }
    
    .aagl-modal .form-table th,
    .aagl-modal .form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    
    .aagl-modal .form-table th {
        border-bottom: none;
    }
}

/* キーワード選択セクション */
.keyword-selection-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.keyword-selection-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #23282d;
    display: flex;
    align-items: center;
    gap: 10px;
}

.selection-constraint {
    font-size: 14px;
    color: #666;
    font-weight: normal;
    background: #f0f6fc;
    padding: 4px 8px;
    border-radius: 3px;
    border: 1px solid #c3c4c7;
}

.selection-counter {
    margin-bottom: 15px;
    font-weight: 600;
    color: #23282d;
}

#sub-keyword-count {
    color: #0073aa;
    font-size: 16px;
}

/* キーワードグリッド */
.main-keywords-grid,
.sub-keywords-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

/* キーワード項目 */
.keyword-item {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.keyword-item:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.keyword-item.selected {
    border-color: #0073aa;
    background: #f0f6fc;
    box-shadow: 0 0 0 1px #0073aa;
}

/* ラジオボタン・チェックボックス */
.keyword-radio,
.keyword-checkbox {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 2;
}

/* ラベル */
.keyword-label {
    display: block;
    padding: 15px 45px 15px 15px;
    cursor: pointer;
    position: relative;
    margin: 0;
    font-weight: normal;
}

.keyword-label:hover {
    background: rgba(0, 115, 170, 0.05);
}

/* キーワードテキスト */
.keyword-text {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #23282d;
    margin-bottom: 8px;
    line-height: 1.3;
}

.keyword-category {
    display: inline-block;
    background: #f0f0f1;
    color: #646970;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 8px;
    text-transform: uppercase;
}

.keyword-priority {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
}

.priority-high {
    background: #d63638;
}

.priority-medium {
    background: #dba617;
}

.priority-low {
    background: #00a32a;
}

/* 選択状態のスタイル */
.keyword-radio:checked + .keyword-label,
.keyword-checkbox:checked + .keyword-label {
    background: #f0f6fc;
    border-left: 4px solid #0073aa;
}

.keyword-radio:checked + .keyword-label .keyword-text,
.keyword-checkbox:checked + .keyword-label .keyword-text {
    color: #0073aa;
}

/* 無効化状態 */
.keyword-item input:disabled + .keyword-label {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f6f7f7;
}

.keyword-item input:disabled:hover + .keyword-label {
    background: #f6f7f7;
}

/* 記事生成セクション */
.generation-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 25px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.selected-keywords-summary {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 25px;
}

.selected-keywords-summary h4 {
    margin: 0 0 15px 0;
    color: #23282d;
    font-size: 16px;
}

.selected-main,
.selected-subs {
    margin-bottom: 10px;
    line-height: 1.5;
}

.selected-main strong,
.selected-subs strong {
    color: #23282d;
    display: inline-block;
    width: 140px;
}

#selected-main-display,
#selected-subs-display {
    color: #0073aa;
    font-weight: 500;
}

/* 生成ボタン */
.generation-controls {
    text-align: center;
}

#generate-article-btn {
    font-size: 16px;
    padding: 12px 24px;
    height: auto;
    line-height: 1.4;
}

#generate-article-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* バリデーションメッセージ */
.validation-message {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

.validation-message.error {
    background: #fef7f7;
    color: #d63638;
    border: 1px solid #f7a2a2;
}

.validation-message.warning {
    background: #fef9e7;
    color: #dba617;
    border: 1px solid #f5d76e;
}

.validation-message.success {
    background: #f0f9ff;
    color: #00a32a;
    border: 1px solid #7dd3fc;
}

/* キーワードなしメッセージ */
.no-keywords-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.no-keywords-message a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}

.no-keywords-message a:hover {
    text-decoration: underline;
}

/* レスポンシブ対応 */
@media screen and (max-width: 1024px) {
    .main-keywords-grid,
    .sub-keywords-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 12px;
    }
}

@media screen and (max-width: 768px) {
    .keyword-selection-section,
    .generation-section {
        padding: 20px;
    }
    
    .main-keywords-grid,
    .sub-keywords-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .keyword-label {
        padding: 12px 35px 12px 12px;
    }
    
    .keyword-text {
        font-size: 15px;
    }
    
    .selected-main strong,
    .selected-subs strong {
        width: 120px;
        font-size: 14px;
    }
    
    #selected-main-display,
    #selected-subs-display {
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .keyword-selection-section,
    .generation-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .keyword-selection-section h3 {
        font-size: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .selection-constraint {
        font-size: 12px;
    }
    
    .selected-keywords-summary {
        padding: 15px;
    }
    
    .selected-main,
    .selected-subs {
        flex-direction: column;
        gap: 5px;
    }
    
    .selected-main strong,
    .selected-subs strong {
        width: auto;
    }
}

/* ===== マニュアルページスタイル ===== */
.aagl-manual-wrap {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    max-width: 1200px;
}

.aagl-manual-nav {
    width: 200px;
    flex-shrink: 0;
}

.aagl-manual-nav-inner {
    position: sticky;
    top: 40px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 15px 0;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.aagl-manual-nav h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 10px;
    padding: 0 15px;
}

.aagl-manual-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.aagl-manual-nav li {
    margin: 0;
}

.aagl-manual-nav a {
    display: block;
    padding: 8px 15px;
    color: #646970;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.aagl-manual-nav a:hover {
    color: #2271b1;
    background: #f0f6fc;
}

.aagl-manual-nav a.active {
    color: #2271b1;
    font-weight: 600;
    border-left-color: #2271b1;
    background: #f0f6fc;
}

.aagl-manual-content {
    flex: 1;
    min-width: 0;
}

.aagl-manual-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.aagl-manual-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2271b1;
}

.aagl-manual-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
    margin: 25px 0 12px;
}

.aagl-manual-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px;
}

.aagl-manual-section p {
    color: #3c434a;
    line-height: 1.7;
    margin: 0 0 12px;
}

.aagl-manual-section ul {
    color: #3c434a;
    line-height: 1.7;
    margin: 0 0 15px;
    padding-left: 20px;
}

.aagl-manual-section ul li {
    margin-bottom: 6px;
}

.aagl-manual-section table {
    margin-top: 10px;
    margin-bottom: 15px;
}

.aagl-manual-section table code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

/* 機能カードグリッド */
.aagl-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 15px 0 20px;
}

.aagl-feature-card {
    background: #f9f9f9;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    padding: 18px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.aagl-feature-card:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.1);
}

.aagl-feature-icon {
    margin-bottom: 8px;
}

.aagl-feature-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #2271b1;
}

.aagl-feature-card strong {
    display: block;
    color: #1d2327;
    margin-bottom: 6px;
    font-size: 14px;
}

.aagl-feature-card p {
    font-size: 13px;
    color: #646970;
    margin: 0;
    line-height: 1.5;
}

/* ステップカード */
.aagl-step-card {
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.aagl-step-card:hover {
    border-color: #2271b1;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.aagl-step-header {
    background: #f6f7f7;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e2e4e7;
}

.aagl-step-badge {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    line-height: 1.4;
}

.aagl-step-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.aagl-step-content {
    padding: 15px 18px;
    background: #fff;
}

.aagl-step-content p {
    margin: 0 0 10px;
}

.aagl-step-content p:last-child {
    margin-bottom: 0;
}

/* 補足メモ */
.aagl-manual-note {
    background: #f0f6fc;
    border-left: 3px solid #2271b1;
    padding: 10px 14px;
    font-size: 13px;
    color: #1d2327;
    border-radius: 0 4px 4px 0;
    margin-top: 10px;
    line-height: 1.6;
}

.aagl-manual-note a {
    color: #2271b1;
}

/* FAQ */
.aagl-faq-item {
    padding: 18px;
    margin-bottom: 10px;
    background: #f9f9f9;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    transition: border-color 0.2s;
}

.aagl-faq-item:hover {
    border-color: #2271b1;
}

.aagl-faq-item h4 {
    color: #2271b1;
    margin: 0 0 10px;
    font-size: 14px;
}

.aagl-faq-item p {
    margin: 0;
    color: #3c434a;
    line-height: 1.7;
}

/* マニュアルレスポンシブ */
@media screen and (max-width: 960px) {
    .aagl-manual-wrap {
        flex-direction: column;
    }

    .aagl-manual-nav {
        width: 100%;
    }

    .aagl-manual-nav-inner {
        position: static;
    }

    .aagl-manual-nav ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
    }

    .aagl-manual-nav a {
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 8px 12px;
    }

    .aagl-manual-nav a.active {
        border-left: none;
        border-bottom-color: #2271b1;
    }

    .aagl-feature-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 600px) {
    .aagl-manual-section {
        padding: 20px;
    }

    .aagl-step-header {
        padding: 10px 14px;
    }

    .aagl-step-content {
        padding: 12px 14px;
    }
}

/* ローディング・メッセージスタイル */
.loading-message,
.no-selection-message,
.no-keywords-message {
    text-align: center;
    padding: 30px 20px;
    color: #666;
    font-style: italic;
}

.loading-message {
    background: #f0f6fc;
    border: 2px solid #c3c4c7;
    border-radius: 8px;
}

.no-selection-message {
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.no-keywords-message {
    background: #fef7f7;
    border: 2px dashed #f7a2a2;
    border-radius: 8px;
    color: #d63638;
}

.no-keywords-message a {
    color: #d63638;
    text-decoration: underline;
}

/* ------------------------------------------------------------------
   テンプレート管理ページ（templates/templates.php から移動）
   ------------------------------------------------------------------ */
.template-variable {
    background: #e7f3ff;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

/* ------------------------------------------------------------------
   キーワード管理ページ（templates/keywords.php から移動）
   ------------------------------------------------------------------ */
.status-active { color: #008a00; font-weight: bold; }
.status-inactive { color: #999; }
.status-completed { color: #0073aa; }


.status-used { color: #0073aa; }

/* タブ機能のCSS */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.postbox {
    background: #fff;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.postbox-header {
    background: #f6f7f7;
    border-bottom: 1px solid #c3c4c7;
    padding: 10px 20px;
}

.postbox-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.postbox .inside {
    padding: 20px;
}

.wp-list-table th,
.wp-list-table td {
    padding: 10px;
    vertical-align: middle;
}

/* ------------------------------------------------------------------
   生成履歴ページ（templates/history.php から移動）
   ------------------------------------------------------------------ */
.aagl-history-page {
    margin-top: 20px;
}

.aagl-no-articles {
    text-align: center;
    padding: 60px 20px;
}

.aagl-empty-state .dashicons {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 20px;
}

.aagl-empty-state h3 {
    color: #666;
    margin-bottom: 10px;
}

.aagl-history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.aagl-history-stats {
    font-size: 14px;
    color: #666;
}

.aagl-history-stats .aagl-stats-range {
    margin-left: 6px;
    font-size: 13px;
    color: #888;
}

.aagl-history-pagination {
    float: none;
    text-align: right;
    margin: 8px 0;
}

.aagl-history-pagination .page-numbers {
    display: inline-block;
    padding: 4px 10px;
    margin-left: 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    text-decoration: none;
    line-height: 1.4;
}

.aagl-history-pagination .page-numbers.current {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    font-weight: bold;
}

.aagl-history-pagination .page-numbers.dots {
    border: none;
    background: transparent;
}

.aagl-history-table .column-title {
    width: 30%;
}

.aagl-history-table .column-date {
    width: 15%;
}

.aagl-history-table .column-status {
    width: 10%;
}

.aagl-history-table .column-keywords {
    width: 30%;
}

.aagl-history-table .column-actions {
    width: 15%;
}

.aagl-post-status {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.aagl-status-published {
    background-color: #46b450;
    color: white;
}

.aagl-status-draft {
    background-color: #ffb900;
    color: white;
}

.aagl-status-other {
    background-color: #ddd;
    color: #666;
}

.aagl-keywords-display .aagl-main-keyword {
    color: #0073aa;
    font-weight: bold;
}

.aagl-keywords-display .aagl-sub-keywords {
    color: #666;
    font-size: 12px;
}

.aagl-row-actions .button {
    margin-right: 5px;
}
