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

body {
    font-family: 'Inter', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    color: #1a1a2e;
}

header {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 50%, #fd79a8 100%);
    color: white;
    padding: 3rem 2rem 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: headerShimmer 8s ease-in-out infinite;
}

@keyframes headerShimmer {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10%, 10%); }
}

header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    margin-bottom: 1.2rem;
    position: relative;
    letter-spacing: 0.02em;
}

nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.6rem 1.5rem;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 50px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
    backdrop-filter: blur(4px);
    background: rgba(255,255,255,0.1);
}

.nav-link:hover {
    background: white;
    color: #6c5ce7;
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.section {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.04);
    transition: box-shadow 0.3s ease;
}

.section:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.section h2 {
    color: #1a1a2e;
    font-family: 'Playfair Display', serif;
    font-size: 1.9rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, #6c5ce7, #fd79a8, #fdcb6e) 1;
}

/* Upload Area */
.upload-area {
    margin-bottom: 1.5rem;
}

#photo-upload {
    display: none;
}

.upload-btn, .add-btn {
    display: inline-block;
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
    padding: 0.75rem 1.75rem;
    border-radius: 50px;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

.upload-btn:hover, .add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
    background: linear-gradient(135deg, #5f4dd0 0%, #9589f0 100%);
}

/* Photo Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.gallery-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

.gallery-item .delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.gallery-item:hover .delete-btn {
    opacity: 1;
}

.gallery-item .caption {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    color: #2d3436;
    background: rgba(255,255,255,0.95);
    cursor: pointer;
    text-align: center;
    transition: background 0.2s ease;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item .caption:hover {
    background: #f0f1ff;
}

.gallery-item .caption-placeholder {
    color: #b2bec3;
    font-style: italic;
}

/* Forms */
.form-container {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(108, 92, 231, 0.15);
}

.form-container.hidden {
    display: none;
}

.form-container input,
.form-container textarea,
.form-container select {
    width: 100%;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

.form-container textarea {
    min-height: 100px;
    resize: vertical;
}

.form-container input:focus,
.form-container textarea:focus,
.form-container select:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.form-buttons {
    display: flex;
    gap: 1rem;
}

.save-btn {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.cancel-btn {
    background: #b2bec3;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: #99a4a9;
    transform: translateY(-1px);
}

/* News Items */
.news-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-item {
    background: linear-gradient(135deg, #fff 0%, #fafbff 100%);
    padding: 1.75rem;
    border-radius: 16px;
    border-left: 5px solid;
    border-image: linear-gradient(180deg, #6c5ce7, #fd79a8) 1;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.news-item h3 {
    color: #2d3436;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.news-item .date {
    color: #6c5ce7;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.news-item p {
    line-height: 1.7;
    color: #636e72;
}

.news-item .delete-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #e74c3c, #fd79a8);
    color: white;
    border: none;
    padding: 0.3rem 0.85rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s;
}

.news-item:hover .delete-btn {
    opacity: 1;
}

/* Family Tree */
.tree-container {
    overflow-x: auto;
    padding: 2rem 0;
}

.tree-generation {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    position: relative;
    padding-top: 1.5rem;
}

.tree-generation::before {
    content: '';
    position: absolute;
    top: -0.25rem;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 0.3rem 1.2rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tree-generation[data-gen="0"]::before {
    content: 'Generation 1';
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
}
.tree-generation[data-gen="1"]::before {
    content: 'Generation 2';
    background: linear-gradient(135deg, #0984e3, #74b9ff);
}
.tree-generation[data-gen="2"]::before {
    content: 'Generation 3';
    background: linear-gradient(135deg, #00b894, #55efc4);
}
.tree-generation[data-gen="3"]::before {
    content: 'Generation 4';
    background: linear-gradient(135deg, #fdcb6e, #f39c12);
}
.tree-generation[data-gen="4"]::before {
    content: 'Generation 5';
    background: linear-gradient(135deg, #fd79a8, #e84393);
}
.tree-generation[data-gen="5"]::before {
    content: 'Generation 6';
    background: linear-gradient(135deg, #e17055, #d63031);
}
.tree-generation[data-gen="6"]::before {
    content: 'Generation 7';
    background: linear-gradient(135deg, #00cec9, #0984e3);
}
.tree-generation[data-gen="7"]::before {
    content: 'Generation 8';
    background: linear-gradient(135deg, #6c5ce7, #e84393);
}
.tree-generation[data-gen="8"]::before {
    content: 'Generation 9';
    background: linear-gradient(135deg, #55efc4, #00b894);
}
.tree-generation[data-gen="9"]::before {
    content: 'Generation 10';
    background: linear-gradient(135deg, #f39c12, #e74c3c);
}

.tree-member {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 1.25rem 1.75rem;
    text-align: center;
    min-width: 160px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
}

.tree-member:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.15);
    border-color: #a29bfe;
}

.tree-member.has-spouse {
    border-color: #fd79a8;
    background: linear-gradient(135deg, #fff 0%, #fff5f8 100%);
}

.tree-member.has-spouse:hover {
    box-shadow: 0 8px 25px rgba(253, 121, 168, 0.2);
}

.tree-member h4 {
    color: #2d3436;
    margin-bottom: 0.3rem;
    font-weight: 600;
    font-size: 1rem;
}

.tree-member .years {
    font-size: 0.82rem;
    color: #6c5ce7;
    font-weight: 500;
}

.tree-member .spouse {
    font-size: 0.82rem;
    color: #e84393;
    margin-top: 0.5rem;
    font-style: italic;
    font-weight: 500;
}

.tree-member .delete-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #e74c3c, #ff6b6b);
    color: white;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.tree-member .edit-btn {
    position: absolute;
    bottom: -10px;
    right: -6px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    padding: 0.2rem 0.7rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.tree-member:hover .delete-btn,
.tree-member:hover .edit-btn {
    opacity: 1;
}

/* Family History */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.history-item {
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
    padding: 2rem;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border-left: 5px solid;
    border-image: linear-gradient(180deg, #fdcb6e, #e17055) 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.history-item h3 {
    color: #2d3436;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.history-era {
    display: inline-block;
    background: linear-gradient(135deg, #fdcb6e, #f39c12);
    color: white;
    padding: 0.2rem 0.85rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: 0.03em;
}

.history-content {
    line-height: 1.8;
    color: #636e72;
    white-space: pre-wrap;
}

.history-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.history-item:hover .history-actions {
    opacity: 1;
}

.history-actions .edit-btn {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    padding: 0.3rem 0.85rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
}

.history-actions .delete-btn {
    background: linear-gradient(135deg, #e74c3c, #fd79a8);
    color: white;
    border: none;
    padding: 0.3rem 0.85rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
}

.empty-message {
    text-align: center;
    color: #b2bec3;
    font-style: italic;
    padding: 3rem 2rem;
    font-size: 1.05rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2.5rem;
    background: linear-gradient(135deg, #2d3436 0%, #1a1a2e 100%);
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 2rem 1.5rem;
    }

    header h1 {
        font-size: 2rem;
    }

    nav {
        gap: 0.5rem;
    }

    .nav-link {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }

    main {
        padding: 1rem;
    }

    .section {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .tree-generation {
        gap: 1rem;
    }
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox.hidden {
    display: none;
}
