/* People Page Specific Styles */

.people-page {
    background-color: #f8f9fa;
    min-height: calc(100vh - 200px);
}

.page-header {
    text-align: center;
    padding: 2rem 0;
    background: white;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #666;
    font-size: 1.1rem;
}

/* Search and Filters */
.search-filters {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-row {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    min-width: 300px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
    transform: scale(1.02);
}

.search-input:valid {
    border-color: var(--success-color);
}

.search-input::placeholder {
    color: #999;
    font-style: italic;
}

.search-btn {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-btn:hover {
    background-color: var(--secondary-color);
}

.clear-search {
    padding: 12px 16px;
    color: var(--accent-color);
    text-decoration: none;
    border: 1px solid var(--accent-color);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.clear-search:hover {
    background-color: var(--accent-color);
    color: white;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-options {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
    user-select: none;
}

.filter-checkbox input[type="checkbox"] {
    margin: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.filter-checkbox:hover {
    color: var(--primary-color);
}

.sort-options label {
    font-weight: 600;
    color: var(--primary-color);
}

.sort-options select {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    background-color: white;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.view-btn {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background: white;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Search Results Info */
.search-results-info {
    background: #e8f4fd;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.search-results-info p {
    margin: 0;
    color: var(--primary-color);
    font-weight: 500;
}

/* People Grid */
.people-grid-container {
    min-height: 500px;
}

.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.person-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.person-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.person-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.person-card:hover::before {
    opacity: 1;
}

.person-card:focus-within {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.person-photo {
    text-align: center;
    margin-bottom: 0.75rem;
}

.person-photo img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.person-card:hover .person-photo img {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.photo-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #e67e22);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 auto;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.person-card:hover .photo-placeholder {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.person-info h3 {
    margin-bottom: 0.3rem;
    font-size: 1.2rem;
    text-align: center;
}

.person-info h3 a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.person-info h3 a:hover {
    color: var(--accent-color);
}

.person-nickname {
    text-align: center;
    color: var(--accent-color);
    font-style: italic;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.person-details {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.person-details p {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.date-label {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 40px;
}

.person-date {
    color: #555;
}

.person-place {
    color: #666;
}

.person-occupation {
    color: #777;
}

.person-age {
    color: #007bff;
    font-weight: 500;
    margin: 0.3rem 0;
}

.place-icon, .occupation-icon, .age-icon {
    font-size: 0.8rem;
}

.person-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    margin-top: 0.75rem;
}

.btn-small {
    padding: 6px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid;
    text-align: center;
    white-space: nowrap;
    flex: 1;
    min-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-small.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-small.btn-primary:hover {
    background-color: transparent;
    color: var(--primary-color);
}

.btn-small.btn-secondary {
    background-color: transparent;
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-small.btn-secondary:hover {
    background-color: var(--accent-color);
    color: white;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

.no-results h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.no-results p {
    color: #666;
    margin-bottom: 2rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.page-link {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-decoration: none;
    color: var(--primary-color);
    background-color: white;
    transition: all 0.3s ease;
    font-weight: 500;
}

.page-link:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-link.current {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 700;
}

.pagination-info {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Active Navigation */
.nav-menu a.active {
    color: var(--accent-color);
    font-weight: 700;
}

/* Responsive Design */
@media (max-width: 768px) {
    .people-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
    
    .search-form {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .search-input-group {
        min-width: auto;
    }
    
    .sort-options {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .filter-options {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .person-actions {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .pagination {
        gap: 0.25rem;
    }
    
    .page-link {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .people-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        padding: 1rem 0;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .search-filters {
        padding: 1rem;
    }
    
    .person-card {
        padding: 1rem;
    }
}

/* Tree View Styles */
.people-tree-container {
    background: #f5f5f5;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 600px;
    position: relative;
}

.tree-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 500;
}

.tree-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

.tree-scroll-container {
    overflow-x: auto;
    overflow-y: auto;
    padding: 2rem;
    max-height: 80vh;
    background: #f8f9fa;
}

.family-tree-list {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    min-width: max-content;
    padding-bottom: 2rem;
}

.generation-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 250px;
}

.generation-header {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.family-branch {
    background: white;
    border-radius: 10px;
    border: 1px solid #d0d0d0;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.family-branch:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.branch-header {
    background: var(--secondary-color);
    color: white;
    padding: 0.8rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.branch-header:hover {
    background: var(--primary-color);
}

.branch-toggle {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.family-branch.collapsed .branch-toggle {
    transform: rotate(-90deg);
}

.branch-content {
    padding: 1rem;
    transition: all 0.3s ease;
    background: #fdfdfd;
}

.family-branch.collapsed .branch-content {
    display: none;
}

.tree-person {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    border-radius: 8px;
    background: white;
    margin-bottom: 0.8rem;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tree-person:hover {
    background: #f0f8ff;
    border-color: var(--primary-color);
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}

.tree-person-photo {
    flex-shrink: 0;
}

.tree-person-photo img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tree-person .photo-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tree-person-info {
    flex: 1;
    min-width: 0;
}

.tree-person-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.2rem;
    text-decoration: none;
    display: block;
}

.tree-person-name:hover {
    color: var(--accent-color);
}

.tree-person-dates {
    font-size: 0.85rem;
    color: #5a5a5a;
    line-height: 1.3;
    font-weight: 500;
}

.tree-person-place {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-top: 0.2rem;
}

.children-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.children-header {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.child-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tree-child {
    padding: 0.5rem;
    background: #f1f3f4;
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
    color: #444;
    font-weight: 500;
}

/* Connection Lines */
.generation-connector {
    position: relative;
    width: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.generation-connector::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    transform: translateY(-1px);
}

.generation-connector::after {
    content: '→';
    background: white;
    color: var(--primary-color);
    padding: 0 0.5rem;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Responsive Tree View */
@media (max-width: 768px) {
    .tree-scroll-container {
        padding: 1rem;
    }
    
    .family-tree-list {
        gap: 1rem;
    }
    
    .generation-column {
        min-width: 200px;
    }
    
    .tree-person {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .tree-person-photo img,
    .tree-person .photo-placeholder {
        width: 40px;
        height: 40px;
    }
    
    .tree-person .photo-placeholder {
        font-size: 0.9rem;
    }
}