/* ベーススタイル */
body {
    font-family: 'Noto Sans JP', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8fafc;
    color: #1e293b;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ヘッダー共通スタイル */
.header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 0;
    width: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.user-role {
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-role.admin-role { background: #10b981; }
.user-role.reviewer-role { background: #f59e0b; }
.user-role.target-role { background: #8b5cf6; }
.user-role.system-admin-role { background: #3b82f6; } /* システム管理者用 */

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-name {
    font-weight: 600;
    color: #1e293b;
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* メインコンテンツ */
.main-content {
    min-height: calc(100vh - 80px);
    padding: 2rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ページヘッダー */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.page-title h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
    margin-top: 0;
}

.subtitle {
    color: #64748b;
    font-size: 1rem;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 1rem;
}

/* ボタン */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}
.btn-primary:hover { background: #2563eb; }

.btn-secondary {
    background: #64748b;
    color: white;
}
.btn-secondary:hover { background: #475569; }

.btn-outline {
    background: transparent;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}
.btn-outline:hover {
    background: #3b82f6;
    color: white;
}

/* ダッシュボード統計カード */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    border-left: 4px solid #cbd5e1; /* Default */
}
.stat-card.admin { border-left-color: #10b981; }
.stat-card.evaluator { border-left-color: #f59e0b; }
.stat-card.target { border-left-color: #8b5cf6; }
.stat-card.system { border-left-color: #3b82f6; }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

/* クイックアクション */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.action-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.action-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    background: #eff6ff;
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.action-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.action-desc {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

/* フォームセクション */
.form-section {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f1f5f9;
    margin-top: 0;
}

/* フォーム要素 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* テーブル */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: #f8fafc;
    padding: 1rem;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

tr:last-child td {
    border-bottom: none;
}

/* 評価入力の評価項目 */
.evaluation-item {
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
}

.evaluation-criteria {
    margin-bottom: 1rem;
}
.criteria-list {
    margin-left: 1.5rem;
    list-style: disc;
    color: #475569;
}

.rating-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.rating-buttons input[type="radio"] {
    display: none;
}

.rating-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s;
}

input[type="radio"]:checked + .rating-btn {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* ナビゲーション */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.year-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid #e2e8f0;
}

.year-nav-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem;
}
.year-nav-btn:hover { color: #3b82f6; }

/* 組織図プレビュー（チャート形式） */
.chart-preview {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 2rem;
    overflow-x: auto;
    min-height: 400px;
    display: flex;
    justify-content: center;
}

.chart-node-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.chart-node-box {
    background: white;
    border: 2px solid #3b82f6;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.chart-node-name {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.875rem;
}

.chart-node-meta {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.chart-children-container {
    display: flex;
    gap: 2rem;
    position: relative;
    padding-top: 1rem;
}

/* 接続線 */
.chart-children-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 1rem;
    background: #cbd5e1;
}

.chart-node-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.chart-node-wrapper::before {
    content: '';
    position: absolute;
    top: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 1rem;
    background: #cbd5e1;
}

/* 横線（最初と最後の子要素以外をつなぐ） */
.chart-children-container > .chart-node-wrapper:not(:only-child)::after {
    content: '';
    position: absolute;
    top: -1rem;
    height: 2px;
    background: #cbd5e1;
    width: 100%;
    left: 0;
}

.chart-children-container > .chart-node-wrapper:first-child::after {
    width: 50%;
    left: 50%;
}

.chart-children-container > .chart-node-wrapper:last-child::after {
    width: 50%;
    left: 0;
}

/* ルートノードの上の線は消す */
.chart-root > .chart-node-wrapper::before {
    display: none;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {

    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 0.5rem 1rem;
    }

    .header-left, .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .user-info {
        flex-direction: row-reverse; /* アバターを左に */
    }
    .user-name {
        display: none; /* スマホでは名前を隠す */
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .page-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .dashboard-stats {
        grid-template-columns: 1fr; /* 1列表示 */
    }

    .quick-actions {
        grid-template-columns: 1fr; /* 1列表示 */
    }

    .container {
        padding: 0 1rem;
    }

    /* テーブルのスマホ対応 */
    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
}
