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

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    min-height: 100vh;
    position: relative;
}

/* Header */
header {
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.9), rgba(139, 0, 0, 0.9));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(183, 28, 28, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    width: 100%;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

nav a {
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.3px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

nav a i {
    font-size: 16px;
    transition: all 0.3s ease;
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background: #fff;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

nav a:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

nav a:hover i {
    transform: scale(1.2) rotate(5deg);
}

nav a:hover::after {
    width: calc(100% - 40px);
}

/* Hero section */
.hero {
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.4), rgba(139, 0, 0, 0.4)), url('hero.jpg') no-repeat center/cover;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.1), rgba(139, 0, 0, 0.1));
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.hero h2 {
    font-size: 3rem;
    text-align: center;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.8s ease-out;
}

/* Main content */
main {
    padding: 2rem;
}

section {
    margin-bottom: 2rem;
}

/* Key Sections Grid */
.key-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.key-section-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.08) 0%, rgba(139, 0, 0, 0.05) 100%);
    border: 2px solid #B71C1C;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(183, 28, 28, 0.1);
}

.key-section-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(183, 28, 28, 0.25);
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.15) 0%, rgba(139, 0, 0, 0.1) 100%);
    border-color: #8B0000;
}

.key-section-card .card-icon {
    font-size: 3rem;
    color: #B71C1C;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.key-section-card:hover .card-icon {
    color: #8B0000;
    transform: scale(1.15);
}

.key-section-card h3 {
    font-size: 1.4rem;
    color: #B71C1C;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.key-section-card p {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.5;
}

/* History Page Styling */
.history-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.history-card {
    padding: 2rem;
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.06) 0%, rgba(139, 0, 0, 0.03) 100%);
    border: 2px solid #B71C1C;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(183, 28, 28, 0.12);
    transition: all 0.3s ease;
}

.history-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(183, 28, 28, 0.2);
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.12) 0%, rgba(139, 0, 0, 0.06) 100%);
    border-color: #8B0000;
}

.history-card .card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #B71C1C;
}

.history-card .card-header i {
    font-size: 2rem;
    color: #B71C1C;
    transition: all 0.3s ease;
}

.history-card:hover .card-header i {
    color: #8B0000;
    transform: scale(1.1);
}

.history-card .card-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: #333;
    font-weight: 600;
}

.history-card p {
    margin: 0;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
}

.history-card a {
    color: #1E3A8A;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid #1E3A8A;
    transition: all 0.2s ease;
}

.history-card a:hover {
    color: #B71C1C;
    border-bottom-color: #B71C1C;
}

/* Family Stories Section */
.family-stories-section {
    margin-top: 4rem;
    padding: 2.5rem;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.08) 0%, rgba(183, 28, 28, 0.04) 100%);
    border: 2px solid #1E3A8A;
    border-radius: 12px;
}

.family-stories-section h2 {
    color: #1E3A8A;
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.family-stories-section h2 i {
    font-size: 1.5rem;
}

.stories-intro {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.story-card {
    padding: 1.8rem;
    background: white;
    border-left: 4px solid #B71C1C;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-left-color: #8B0000;
}

.story-card .story-header {
    font-size: 1.15rem;
    font-weight: 600;
    color: #B71C1C;
    margin-bottom: 1rem;
}

.story-card p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* Hero subtitle for history page */
.hero p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.5rem;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Footer */
footer {
    background: #222;
    color: #ccc;
    text-align: center;
    padding: 1rem;
    position: relative;
    bottom: 0;
    width: 100%;
}

/* Utility classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Dark mode toggle */
.dark-mode {
    background: #121212;
    color: #e0e0e0;
}

.dark-mode header {
    background: #1f1f1f;
}

.dark-mode footer {
    background: #111;
}

/* Form Styles */
.form-intro {
    margin-bottom: 40px;
}

.form-intro h2 {
    margin-bottom: 20px;
    color: #333;
}

.intro-banner {
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.75), rgba(139, 0, 0, 0.75));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #fff;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(183, 28, 28, 0.3);
}

.intro-banner p {
    margin: 10px 0;
    font-size: 16px;
}

.intro-banner p:first-child {
    font-size: 20px;
    margin-bottom: 15px;
}

/* Steps Guide */
.steps-guide {
    margin-bottom: 35px;
}

.steps-guide h3 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 20px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.step {
    background: rgba(249, 249, 249, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left: 4px solid #B71C1C;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    gap: 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(183, 28, 28, 0.12);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #B71C1C;
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    color: #333;
    margin-bottom: 5px;
    font-size: 16px;
}

.step-content p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

.form-container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(183, 28, 28, 0.18);
    padding: 30px;
}

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

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

input, textarea, select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #999;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    border-color: #B71C1C;
    box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.15);
}

/* Error highlight for empty required fields */
.field-error {
    border-color: #E74C3C !important;
    background: rgba(231, 76, 60, 0.05) !important;
}

.field-error-group {
    position: relative;
}

.field-error-group::after {
    content: '⚠ Required';
    position: absolute;
    right: 10px;
    top: -18px;
    font-size: 0.75rem;
    color: #E74C3C;
    font-weight: 600;
}

/* Inline error message attached to field */
.field-error-message {
    background: #ffe6e6;
    border-left: 3px solid #E74C3C;
    color: #C0392B;
    padding: 8px 12px;
    margin: 5px 0 10px 0;
    border-radius: 4px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

.field-error-message i {
    color: #E74C3C;
}

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

button {
    background: linear-gradient(135deg, #B71C1C, #8B0000);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(183, 28, 28, 0.35);
}

button:hover {
    background: linear-gradient(135deg, #8B0000, #6B0000);
    box-shadow: 0 6px 20px rgba(183, 28, 28, 0.45);
    transform: translateY(-2px);
}

button:disabled {
    background: linear-gradient(135deg, #ccc, #aaa);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

button:disabled:hover {
    transform: none;
    box-shadow: none;
}

button.reset-btn {
    background: #1E3A8A;
    margin-left: 10px;
}

button.reset-btn:hover {
    background: #153060;
}

button.submit-another-btn {
    background: #B71C1C;
    margin-top: 10px;
}

button.submit-another-btn:hover {
    background: #8B0000;
}

button.add-topic-btn {
    background: #1E3A8A;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
}

.btn-main {
    font-weight: 600;
    font-size: 1rem;
}

.btn-help {
    font-size: 0.75rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 5px;
}

button.add-topic-btn:hover {
    background: #153060;
}

button.remove-topic-btn {
    background: #E74C3C;
    padding: 8px 16px;
    font-size: 14px;
}

button.remove-topic-btn:hover {
    background: #C0392B;
}

.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.required::after {
    content: ' *';
    color: red;
}

/* Fieldset & Legend Styles */
fieldset {
    border: 2px solid #B71C1C;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(245,245,245,0.95));
    box-shadow: 0 4px 15px rgba(183, 28, 28, 0.15);
}

legend {
    font-weight: 700;
    font-size: 1.1rem;
    color: #B71C1C;
    padding: 0 15px;
    margin-left: -15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

legend i {
    color: #B71C1C;
    font-size: 1.2rem;
}

label i {
    color: #B71C1C;
    margin-right: 6px;
    font-size: 0.95rem;
    min-width: 16px;
}

.topic-fieldset label i {
    color: #1E3A8A;
}

.nested-fieldset label i {
    color: #8B0000;
}

/* Topic fieldsets - similar styling */
.topic-fieldset {
    border: 2px solid #1E3A8A;
    background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(240,248,255,0.95));
}

.topic-fieldset legend {
    color: #1E3A8A;
    border-bottom: 2px solid #1E3A8A;
    padding-bottom: 10px;
    margin-bottom: 15px;
    width: 100%;
}

/* Nested fieldsets (Content & Evidence inside topics) */
.nested-fieldset {
    border: 2px solid #8B0000;
    background: linear-gradient(135deg, rgba(255,245,245,0.95), rgba(255,235,235,0.90));
    margin-top: 20px;
    border-radius: 8px;
}

.nested-fieldset legend {
    font-size: 1rem;
    color: #8B0000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nested-fieldset legend i {
    color: #8B0000;
}

/* Topic section styling */
#topicsContainer {
    margin-bottom: 20px;
}

.topic-fieldset {
    position: relative;
}

.topic-number {
    font-weight: normal;
    color: #666;
}

/* Checkbox Styles */
.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox input {
    width: auto;
    margin: 0;
}

.checkbox-label {
    margin: 0;
    font-weight: normal;
}

/* File Upload Styles */
input[type="file"] {
    padding: 8px;
}

small {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Contributors List Styles */
#contributorsSection,
#homeContributorsSection {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(183, 28, 28, 0.2);
    box-shadow: 0 4px 15px rgba(183, 28, 28, 0.15);
}

.contrib-note {
    font-size: 0.9rem;
    color: #555;
    margin: 5px 0 12px;
    font-style: italic;
}

/* Help text for form sections */
.field-help-text {
    font-size: 0.85rem;
    color: #666;
    background: rgba(183, 28, 28, 0.05);
    padding: 10px;
    border-left: 3px solid #B71C1C;
    border-radius: 4px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-help-text i {
    color: #B71C1C;
    font-size: 0.9rem;
}
/* Preview box showing data before final submit */
.preview-box {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 239, 239, 0.95));
    border: 2px solid #B71C1C;
    border-radius: 10px;
    padding: 0;
    margin-bottom: 20px;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(183, 28, 28, 0.2);
}

.preview-header {
    background: linear-gradient(135deg, #B71C1C, #8B0000);
    color: #fff;
    padding: 12px 15px;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-header i {
    font-size: 1.1rem;
}

.preview-content {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

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

.preview-content li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(183, 28, 28, 0.1);
    color: #333;
}

.preview-content li:last-child {
    border-bottom: none;
}

.preview-content strong {
    color: #B71C1C;
    font-weight: 600;
}

.preview-content button {
    margin-top: 12px;
    background: linear-gradient(135deg, #B71C1C, #8B0000);
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.preview-content button:hover {
    background: linear-gradient(135deg, #8B0000, #6B0000);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(183, 28, 28, 0.3);
}
#contributorsSection h3 {
    margin-top: 0;
    color: #B71C1C;
}

#contributorsList,
#homeContributorsList {
    list-style: none;
    color: #333;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    padding-left: 0;
}

#contributorsList li,
#homeContributorsList li {
    background: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #B71C1C;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#contributorsList li:hover,
#homeContributorsList li:hover {
    background: rgba(183, 28, 28, 0.05);
}

#contributorsList li i,
#homeContributorsList li i {
    color: #B71C1C;
    font-size: 0.9rem;
}

#contributorsList li {
    margin-bottom: 5px;
}

/* Family Tree Styles */
.tree {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.person {
    border: 1px solid #ddd;
    padding: 10px;
    margin: 5px;
    border-radius: 5px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
}

.person:hover {
    background: #f0f0f0;
    border-color: #B71C1C;
    box-shadow: 0 2px 8px rgba(183, 28, 28, 0.2);
}

.children {
    display: flex;
    justify-content: center;
}

.search {
    margin-bottom: 20px;
}

.highlight {
    background: rgba(183, 28, 28, 0.25) !important;
    border-color: #B71C1C;
    font-weight: bold;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Smooth transitions */
* {
    transition: color 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        gap: 0.5rem;
    }

    nav a {
        padding: 8px 12px;
        font-size: 13px;
    }

    nav a i {
        font-size: 14px;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .steps {
        grid-template-columns: 1fr;
    }

    .form-container {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    nav a {
        padding: 6px 10px;
        font-size: 12px;
        gap: 5px;
    }

    nav a i {
        font-size: 12px;
    }

    nav ul {
        gap: 0.25rem;
    }
}

/* Contributors Grid */
.contributors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.contributor-card {
    background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 16px;
    font-weight: 500;
}

.contributor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
