/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #2c3e50;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-title {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    margin: 0;
}

/* Main Layout */
.main-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Sidebar */
.sidebar {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #34495e;
}

.upload-section {
    text-align: center;
}

.upload-info {
    background: #ecf0f1;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.stats {
    margin-top: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 8px;
}

.stat-label {
    font-weight: 600;
    color: #7f8c8d;
}

.stat-value {
    font-weight: bold;
    color: #3498db;
    font-size: 1.2rem;
}

.info-text {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 10px;
    text-align: center;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 10px;
}

.btn-primary {
    background: #27ae60;
    color: white;
}

.btn-primary:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Main Content */
.main-content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #ecf0f1;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 12px 24px;
    background: none;
    border: none;
    color: #7f8c8d;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: #3498db;
}

.tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

/* Tab Panels */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

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

.stat-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #3498db;
}

.stat-box h3 {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
}

/* Columns Grid */
.columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 30px;
}

.column-item {
    background: #ecf0f1;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.column-item::before {
    content: "✓ ";
    color: #27ae60;
    font-weight: bold;
}

/* Validation Box */
.validation-box {
    background: #d5f4e6;
    border: 1px solid #27ae60;
    border-radius: 8px;
    padding: 20px;
    color: #27ae60;
    font-weight: 600;
}

.validation-box.warning {
    background: #fff3cd;
    border-color: #f39c12;
    color: #f39c12;
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

.search-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #34495e;
}

.person-select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.person-select:focus {
    outline: none;
    border-color: #3498db;
}

/* Explorer Content */
.explorer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.tree-column, .details-column {
    min-height: 400px;
}

.tree-column h3, .details-column h3 {
    margin-bottom: 15px;
    color: #34495e;
}

/* Family Tree */
.family-tree {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 30px;
    color: white;
    min-height: 400px;
}

.tree-level {
    margin: 20px 0;
    text-align: center;
}

.tree-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 10px;
    font-weight: bold;
}

.tree-person-btn {
    background: white;
    color: #2c3e50;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    margin: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.tree-person-btn.selected {
    background: #3498db;
    color: white;
    border: 3px solid #f1c40f;
    font-size: 1.1em;
}

.tree-connector {
    color: rgba(255, 255, 255, 0.8);
    font-size: 3rem;
    margin: 10px 0;
}

.horizontal-connector {
    color: rgba(255, 255, 255, 0.8);
    font-size: 2rem;
    display: inline-block;
    margin: 0 10px;
}

.tree-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.placeholder-text {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    text-align: center;
    padding: 40px;
}

/* Person Card */
.person-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #3498db;
}

.person-card h4 {
    color: #34495e;
    margin-bottom: 15px;
}

.person-detail {
    margin-bottom: 10px;
}

.person-detail strong {
    color: #7f8c8d;
    font-weight: 600;
}

/* Connections Section */
.connections-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #ecf0f1;
}

.connection-group {
    margin-bottom: 25px;
}

.connection-header {
    color: #27ae60;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.connection-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.connection-btn {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 10px 16px;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.connection-btn:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
    transform: translateY(-2px);
}

/* Edit Form */
.edit-section {
    margin-bottom: 30px;
}

.edit-form {
    margin-top: 30px;
}

.form-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #34495e;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

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

.form-group input:disabled {
    background: #ecf0f1;
    cursor: not-allowed;
}

/* Data Table */
.table-controls {
    margin-bottom: 20px;
}

.table-controls label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #34495e;
}

.table-controls input[type="range"] {
    width: 300px;
}

.table-container {
    overflow-x: auto;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #34495e;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #ecf0f1;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* Info Box */
.info-box {
    background: #f8f9fa;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.info-box pre {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    margin: 0;
}

/* Chart Container */
.chart-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.chart-label {
    min-width: 100px;
    font-weight: 600;
    color: #34495e;
}

.chart-bar-fill {
    height: 30px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: bold;
    transition: width 0.5s ease;
}

/* Footer */
.footer {
    background: #34495e;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .explorer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-title {
        font-size: 1.5rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}