/* ===== 管理画面共通CSS ===== */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: '"メイリオ", "Hiragino Sans", "ヒラギノ角ゴ Pro", "Yu Gothic", "游ゴシック", sans-serif';
    background-color: #f8f8f8;
    color: #222;
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: white;
}

/* ヘッダー */
header {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #222;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

header p {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.nav-links {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-block;
    padding: 8px 16px;
    background-color: #f0f0f0;
    color: #0066cc;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: #e8e8e8;
}

/* メイン */
main {
    padding: 40px 30px;
}

/* セクション */
.section {
    margin-bottom: 40px;
}

.section h2 {
    font-size: 20px;
    font-weight: 700;
    color: #222;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0066cc;
}

.section-desc {
    background-color: #f8f9fa;
    color: #333;
    margin: 0 0 20px 0;
    padding: 15px 15px 15px 20px;
    border-left: 4px solid #0066cc;
    font-size: 14px;
    line-height: 1.7;
}

.section-desc strong {
    font-weight: 600;
    color: #222;
}

/* カテゴリグリッド */
.categories-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.category-card {
    border: 1px solid #e0e0e0;
    border-left: 4px solid #0066cc;
    background-color: #fff;
    padding: 20px;
    transition: all 0.2s;
}

.category-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.category-card.disabled {
    opacity: 0.6;
    background-color: #fafafa;
    border-left-color: #ccc;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.category-title {
    display: flex;
    gap: 15px;
    flex: 1;
    align-items: flex-start;
}

.category-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #f0f0f0;
    color: #0066cc;
    font-weight: 700;
    font-size: 18px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.category-name {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    margin-bottom: 5px;
}

.category-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid;
}

.status-enabled {
    background-color: #e6f2ff;
    color: #0066cc;
    border-color: #b3d9ff;
}

.status-disabled {
    background-color: #f5f5f5;
    color: #999;
    border-color: #e0e0e0;
}

/* コントロールグループ */
.control-group {
    display: grid;
    gap: 15px;
}

.toggle-control {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border: 1px solid #e8e8e8;
}

.toggle-control input[type="checkbox"],
.toggle-control input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: #0066cc;
    cursor: pointer;
}

.toggle-label,
.toggle-control label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    flex: 1;
}

.toggle-label strong,
.toggle-control label strong {
    color: #222;
    font-size: 14px;
    font-weight: 600;
}

.toggle-label small {
    color: #999;
    font-size: 13px;
}

/* ウェイトコントロール */
.weight-control {
    display: grid;
    gap: 10px;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border: 1px solid #e8e8e8;
}

.weight-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.weight-value {
    background-color: #f0f0f0;
    color: #0066cc;
    padding: 4px 8px;
    font-weight: 700;
    font-size: 13px;
    min-width: 45px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.weight-input {
    width: 80px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 13px;
    text-align: center;
}

.weight-slider {
    width: 100%;
    height: 4px;
    border-radius: 0;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.weight-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 2px;
    background: #0066cc;
    cursor: pointer;
    border: none;
}

.weight-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    background: #0066cc;
    cursor: pointer;
    border: none;
}

.weight-info {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* テーブル */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 14px;
}

.info-table th,
.info-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

.info-table th {
    background-color: #f5f5f5;
    font-weight: 700;
    color: #222;
}

.info-table tr:nth-child(even) {
    background-color: #fafafa;
}

.info-table tr.cat-2 {
    background-color: #fff8e1;
}

.info-table tr.cat-2 td {
    border-color: #ffe0b2;
}

.info-table tr.cat-5 {
    background-color: #f0f8ff;
}

.info-table tr.cat-5 td {
    border-color: #cce5ff;
}

.info-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid;
}

.badge-high {
    background-color: #fff5f5;
    color: #dc3545;
    border-color: #ffcccc;
}

.badge-medium {
    background-color: #fffbf0;
    color: #f59e0b;
    border-color: #ffe4b3;
}

.badge-low {
    background-color: #e6f2ff;
    color: #0066cc;
    border-color: #b3d9ff;
}

/* アクション */
.actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

button {
    padding: 12px 24px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-save {
    background-color: #0066cc;
    color: white;
    flex: 1;
}

.btn-save:hover {
    background-color: #0052a3;
}

.btn-save:active {
    transform: translateY(1px);
}

.btn-save.saving {
    opacity: 0.7;
    pointer-events: none;
}

.btn-save:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn-reset {
    background-color: #f0f0f0;
    color: #222;
    border: 1px solid #ddd;
}

.btn-reset:hover {
    background-color: #e0e0e0;
}

.btn-primary {
    background-color: #0066cc;
    color: white;
}

.btn-primary:hover {
    background-color: #0052a3;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* メッセージ */
.message {
    padding: 15px 15px 15px 20px;
    margin-bottom: 20px;
    display: none;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
    position: relative;
}

.message.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.success {
    background-color: #f0fff4;
    color: #155e3a;
    border-left-color: #22c55e;
}

.message.error {
    background-color: #fff5f5;
    color: #721c24;
    border-left-color: #dc3545;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* フッター */
footer {
    background-color: #f5f5f5;
    color: #666;
    text-align: center;
    padding: 20px 30px;
    font-size: 12px;
    border-top: 1px solid #ddd;
}

footer a {
    color: #0066cc;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* レスポンシブ */
@media (max-width: 768px) {
    main {
        padding: 20px;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 22px;
    }

    .category-header {
        flex-direction: column;
    }

    .actions {
        flex-direction: column;
    }

    .btn-save, .btn-reset {
        flex: 1;
    }
}
