/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,900;1,400;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+Pro:ital,wght@0,400;0,600;0,700;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,300;0,400;0,700;1,400&display=swap');

/* Base styles */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --text-color: #2c3e50;
    --background-color: #f8f9fa;
    --container-width: 1200px;
}

body {
    font-family: 'Lato', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Typography */
.title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 900;
    font-style: italic;
    color: var(--primary-color);
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    margin: 0;
    text-align: center;
}

.tagline {
    text-align: center;
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin: 2rem 0;
}

/* Navigation */
.nav-container {
    position: relative;
    margin: 1.5rem 0;
    min-height: 60px;
}

.top-nav-bar {
    margin: 0;
    padding: 1rem;
    background: linear-gradient(to right, #f8f9fa, #ffffff, #f8f9fa);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    list-style: none;
}

/* Hamburger Menu Button */
.hamburger-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 6px;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1001;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.hamburger-menu span {
    width: 24px;
    height: 3px;
    background: var(--secondary-color);
    margin: 3px 0;
    transition: 0.3s ease;
    border-radius: 2px;
}

.hamburger-menu:hover,
.hamburger-menu:focus {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
    outline: none;
}

.hamburger-menu:focus {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(44, 62, 80, 0.6);
}

.hamburger-menu.active {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
    background: var(--primary-color);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
    background: var(--primary-color);
}

.top-nav-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, var(--accent-color), var(--secondary-color));
}

.top-nav-bar a {
    color: var(--secondary-color);
    padding: 0.5rem 0;
    position: relative;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
    min-width: 80px;
    font-family: Georgia, serif;
}

.top-nav-bar a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.top-nav-bar a:hover {
    color: var(--accent-color);
}

.top-nav-bar a:hover::after {
    width: 100%;
}

/* Form Elements */
.person-list {
    margin-bottom: 2rem;
}

.person-list b {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.btn-custom {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    margin: 0.5rem;
}

.btn-custom:hover {
    background-color: #2980b9;
    color: white;
}

/* Select Picker Customization */
.bootstrap-select .dropdown-toggle {
    background-color: white;
    border: 1px solid #dee2e6;
    padding: 0.75rem;
}

.bootstrap-select .dropdown-toggle:focus {
    outline: none !important;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Results Display */
.img-center {
    text-align: center;
    margin: 2rem 0;
}

.img-fluid {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Photo Details */
.text-break {
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.text-break b {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
    display: block;
    margin-top: 1rem;
}

/* Person Names */
.person-name {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

/* Section Headers */
h3 {
    font-weight: 700;
    color: var(--primary-color);
    margin: 0.3rem 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
}

h3::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: var(--accent-color);
    margin: 0.5rem auto;
}

/* Chain Display */
.chain-display {
    font-size: 1.1rem;
    color: var(--secondary-color);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chain-display strong {
    color: var(--primary-color);
    font-weight: 600;
}

hr {
    margin: 2rem 0;
    border-color: #eee;
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    margin-top: 3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-social {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: white;
}

.footer .fab {
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s ease;
    font-size: 1.2rem;
}

.footer .fab:hover {
    color: white;
}

.footer-copyright {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
}

/* Account Dropdown */
.account-dropdown {
    position: relative;
    display: inline-block;
}

.account-dropdown .dropdown-content {
    display: none;
    position: fixed;
    background-color: white;
    min-width: 160px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 9999;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.account-dropdown:hover .dropdown-content {
    display: block;
}

.account-dropdown .dropdown-content a {
    color: var(--secondary-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
}

.account-dropdown .dropdown-content a:hover {
    background-color: #f8f9fa;
    color: var(--accent-color);
}

.account-dropdown .dropdown-divider {
    height: 1px;
    background-color: #dee2e6;
    margin: 0;
}

/* Photo Thumbnails */
.photo-thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.photo-thumbnail:hover {
    transform: scale(1.05);
}

.photo-cell {
    width: 120px;
}

/* Modal Styles */
.modal-photo {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.modal-details {
    margin-top: 1rem;
}

.modal-details p {
    margin-bottom: 0.5rem;
}

/* Contact Form */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.card-body {
    padding: 2rem;
}

.form-control {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.75rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.btn-primary {
    background-color: var(--accent-color);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

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

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .nav-container {
        position: relative;
        min-height: 60px;
        margin-top: 1rem;
        padding-right: 80px; /* Make room for hamburger menu */
    }
    
    .hamburger-menu {
        display: flex;
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
        z-index: 1001;
    }
    
    .top-nav-bar {
        flex-direction: column;
        gap: 0;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: rgba(255, 255, 255, 0.98);
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(10px);
        margin-top: 0.5rem;
        opacity: 0;
        transform: translateY(-10px);
        position: relative;
    }
    
    .top-nav-bar.active {
        max-height: 400px;
        padding: 0.75rem 0;
        z-index: 1000;
        transform: translateY(0);
        opacity: 1;
    }
    
    .top-nav-bar li {
        width: 100%;
        text-align: center;
        padding: 0;
        border-bottom: 1px solid #eee;
        margin: 0;
    }
    
    .top-nav-bar li:last-child {
        border-bottom: none;
    }
    
    .top-nav-bar a {
        display: block;
        padding: 1rem 1.5rem;
        width: 100%;
        min-width: auto;
        line-height: 1.4;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .top-nav-bar .ml-auto {
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    .account-dropdown {
        position: static;
        width: 100%;
    }
    
    .account-dropdown .dropdown-content {
        position: static;
        background: none;
        box-shadow: none;
        border: none;
        padding: 0;
        margin-top: 0.5rem;
    }
    
    .account-dropdown .dropdown-content a {
        padding: 1rem 1.5rem;
        border-top: 1px solid #eee;
        line-height: 1.4;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Additional mobile breakpoint for larger phones */
@media (max-width: 480px) {
    .nav-container {
        margin-top: 1rem;
        padding-right: 70px; /* Slightly less padding for smaller screens */
    }
    
    .hamburger-menu {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.6rem;
    }
    
    .hamburger-menu span {
        width: 22px;
        height: 2.5px;
    }
    
    .top-nav-bar {
        border-radius: 10px;
    }
    
    .top-nav-bar a {
        padding: 0.875rem 1.25rem;
        min-height: 44px;
    }
    
    .account-dropdown .dropdown-content a {
        padding: 0.875rem 1.25rem;
        min-height: 44px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 3rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-5 {
    margin-bottom: 3rem;
}

.ml-auto {
    margin-left: auto;
}

.mr-2 {
    margin-right: 0.5rem;
}

/* Back to Top Link */
a[href="#top"] {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-block;
    margin: 1rem 0;
}

a[href="#top"]:hover {
    color: var(--accent-color);
}

/* Loading Spinner */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}