* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.main-content {
    display: flex;
    min-height: calc(100vh - 140px);
}

/* サイドバー */
.sidebar {
    width: 400px;
    border-right: 2px solid #e0e0e0;
    background: #f8f9fa;
    overflow-y: auto;
    max-height: calc(100vh - 140px);
}

.form-section, .person-list-section {
    padding: 25px;
}

.form-section {
    border-bottom: 2px solid #e0e0e0;
}

.form-section h2, .person-list-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
}

.required {
    color: #e74c3c;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary, .btn-tool, .btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    flex: 1;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-tool {
    background: #3498db;
    color: white;
    padding: 8px 15px;
}

.btn-tool:hover {
    background: #2980b9;
}

/* 検索ボックス */
.search-box {
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* 人物リスト */
.person-list {
    list-style: none;
}

.person-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    border-left: 4px solid #667eea;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.person-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.person-item.male {
    border-left-color: #3498db;
}

.person-item.female {
    border-left-color: #e91e63;
}

.person-item-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.person-item-info {
    font-size: 0.9em;
    color: #666;
}

.person-item-actions {
    margin-top: 10px;
    display: flex;
    gap: 5px;
}

.person-item-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.btn-edit {
    background: #3498db;
    color: white;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

/* メインエリア（家系図表示） */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.toolbar {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.family-tree {
    flex: 1;
    padding: 30px;
    overflow: auto;
    position: relative;
    background: linear-gradient(to right, #f8f9fa 1px, transparent 1px),
                linear-gradient(to bottom, #f8f9fa 1px, transparent 1px);
    background-size: 20px 20px;
}

/* 家系図ノード */
.tree-node {
    position: absolute;
    background: white;
    border: 3px solid #667eea;
    border-radius: 10px;
    padding: 15px;
    min-width: 150px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    cursor: move;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tree-node:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.tree-node.male {
    border-color: #3498db;
    background: linear-gradient(135deg, #fff 0%, #e3f2fd 100%);
}

.tree-node.female {
    border-color: #e91e63;
    background: linear-gradient(135deg, #fff 0%, #fce4ec 100%);
}

.tree-node-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
    color: #333;
}

.tree-node-dates {
    font-size: 0.85em;
    color: #666;
}

.tree-node-relation {
    font-size: 0.8em;
    color: #999;
    margin-top: 5px;
    font-style: italic;
}

/* 接続線 */
.connection-line {
    position: absolute;
    background: #667eea;
    z-index: 0;
}

.tree-node {
    z-index: 1;
}

/* 空の状態 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.empty-state-icon {
    font-size: 5em;
    margin-bottom: 20px;
}

.empty-state-text {
    font-size: 1.2em;
}

/* レスポンシブデザイン */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #e0e0e0;
        max-height: none;
    }
}
