@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@900&display=swap');

/* --- CSS RESET --- */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: #f0f2f5; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    width: 100%;
}

/* 🏆 MODERN TOP NAVIGATION BAR */
.site-header {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #eaeaea;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    font-family: 'Nunito', sans-serif;
    font-size: 28px;
    color: #2c3e50;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-nav {
    display: flex;
    gap: 25px;
}

.top-nav a {
    text-decoration: none;
    color: #444444;
    font-weight: 600;
    font-size: 15px;
    transition: color 0.2s;
}

.top-nav a:hover {
    color: #3498db;
}

/* --- LAYOUT FOR MAIN CONTROLS --- */
.controls { 
    background: white; 
    padding: 15px 20px; 
    border-radius: 10px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
    margin-bottom: 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    align-items: center;
    width: 100%;
    max-width: 900px;
    margin-top: 30px; /* Space below the new top bar */
}

.control-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* --- BOTTOM CONTROLS --- */
.export-controls {
    flex-direction: row; 
    justify-content: center; 
    gap: 10px;
    margin: 20px auto 40px auto; 
    padding: 10px 15px; 
    width: fit-content; 
}

/* --- AUTOCOMPLETE SEARCH STYLES --- */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
    max-width: 220px; 
}

#celebSearch {
    width: 100%;
    background: #fdf3e8;
    border-color: #e67e22;
    font-weight: bold;
    color: #e67e22;
}

#celebSearch::placeholder {
    color: #e67e22;
    opacity: 0.8;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e67e22;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 250px; 
    overflow-y: auto;
    z-index: 999;
    list-style: none;
    padding: 0;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none; 
}

.autocomplete-list li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    color: #333;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.autocomplete-list li:last-child {
    border-bottom: none;
}

.autocomplete-list li:hover {
    background-color: #fdf3e8;
}

/* --- IMAGE UPLOAD BUTTON STYLES --- */
.custom-file-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    color: #555;
    font-size: 14px;
    transition: 0.2s;
}

.custom-file-upload:hover { 
    border-color: #3498db; 
    background: #f8fbff; 
}

.uploaded-face {
    position: absolute;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    z-index: 10;
}

input, select { 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    background: white; 
    cursor: pointer; 
    outline: none;
}

button { 
    padding: 10px 15px; 
    background: #007bff; 
    color: white; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: bold; 
    transition: 0.2s; 
}

button:hover { 
    opacity: 0.8; 
    transform: translateY(-2px); 
}

/* --- MODERN COLOR PALETTE --- */
.color-palette {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 6px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid transparent;
}

.color-swatch:hover {
    transform: scale(1.2);
}

.color-swatch.selected {
    border-color: #333;
    box-shadow: 0 0 0 2px white inset, 0 2px 6px rgba(0,0,0,0.2);
    transform: scale(1.15);
}

/* --- CUSTOM EYEDROPPER BUTTON STYLES --- */
.custom-color-wrapper {
    position: relative;
    overflow: hidden;
    background: #f0f2f5; 
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
}

.picker-icon {
    width: 14px;
    height: 14px;
    pointer-events: none; 
}

.custom-color-wrapper input[type="color"] {
    position: absolute;
    top: -10px; 
    left: -10px; 
    width: 50px; 
    height: 50px; 
    opacity: 0; 
    cursor: pointer;
}

#capture-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    background: #f0f2f5; 
    border-radius: 16px;
    min-width: 650px;
}

.chart-container {
    display: flex;
    align-items: flex-end; 
    justify-content: center;
    flex-wrap: wrap; 
    max-width: 780px; 
    margin: 0 auto; 
    gap: 50px; 
    padding: 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    min-height: 350px;
    position: relative;
    width: 100%; /* Fixes the collapsed box width */
}

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

.person-card, .stat-card { 
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}

.person-card { display: flex; flex-direction: column; align-items: center; gap: 15px; }
.avatar-wrapper { position: relative; width: 100px; height: 200px; }
.avatar-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; fill: #e4e6eb; }
.avatar-fill { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transition: clip-path 1.5s cubic-bezier(0.4, 0, 0.2, 1); }
.age-bubble { font-size: 24px; font-weight: 900; color: #333; }
.name-label { font-size: 16px; font-weight: bold; color: #666; text-align: center; }

/* EMPTY STATE */
.empty-state {
    position: absolute;
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #95a5a6;
    animation: fadeInUp 0.6s ease forwards;
    padding: 20px;
    box-sizing: border-box;
    width: 100%; /* Fixes the squished column issue */
}

.empty-state span { 
    font-size: 48px; 
    display: block; 
    margin-bottom: 10px; 
    line-height: 1; /* Fixes overlapping emoji */
}

.empty-state h3 { 
    margin: 0 0 10px 0; 
    color: #7f8c8d; 
    width: 100%;
}

.empty-state p { 
    margin: 0; 
    font-size: 14px; 
    max-width: 400px; 
    line-height: 1.5; 
}

/* STATS BOX STYLES */
.stats-container { display: flex; flex-direction: column; gap: 15px; }
.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-left: 6px solid #ccc; 
}

.stat-header { display: flex; justify-content: space-between; align-items: center; }
.stat-name { font-size: 18px; font-weight: bold; color: #333; }
.stat-age { font-size: 16px; color: #555; font-weight: 600; }

.generation-badge { background: #eef2f5; color: #555; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; }
.zodiac-badge { background: #f3e5f5; color: #8e44ad; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; margin-left: 5px; }
.milestone-text { font-size: 13px; color: #16a085; background: #e8f8f5; padding: 6px 12px; border-radius: 6px; font-weight: 600; margin-top: 5px; display: inline-block; width: fit-content; }

.comparison-text { font-size: 14px; color: #e67e22; background: #fdf3e8; padding: 8px 12px; border-radius: 6px; font-weight: 500; margin-top: 5px; }

/* --- MODERN DELETE BUTTON & BADGE ALIGNMENT --- */
.stat-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.delete-btn { 
    background: #ffebe9; 
    color: #e74c3c; 
    border: none; 
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer; 
    padding: 4px; 
    margin-left: 5px; 
    transition: all 0.2s ease; 
}

.delete-btn svg {
    width: 14px;
    height: 14px;
}

.delete-btn:hover { 
    background: #e74c3c; 
    color: white;
    transform: scale(1.1); 
}

/* --- MOBILE RESPONSIVENESS (SMARTPHONES & TABLETS) --- */
@media (max-width: 768px) {
    body { padding: 0; }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    #capture-area {
        min-width: 100% !important; 
        width: 100%;
        padding: 15px 10px;
    }
    
    .chart-container {
        gap: 15px;
        padding: 20px 10px;
        flex-wrap: wrap;
    }
    
    .stat-card {
        padding: 15px;
        word-wrap: break-word; 
    }

    .stat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .stat-badges {
        justify-content: flex-start;
        width: 100%;
    }

    .controls {
        padding: 15px 10px;
        width: 100%;
    }

    .control-row {
        flex-direction: column;
        width: 100%;
    }
    
    .control-row select, .control-row input, .custom-file-upload {
        width: 100%;
    }

    .autocomplete-wrapper {
        max-width: none;
    }

    .export-controls {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .export-controls button, .export-controls select {
        width: 100%;
    }
}

/* --- CROPPER MODAL STYLES --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6);
    align-items: center; 
    justify-content: center;
}

.modal-content {
    background: white; 
    padding: 25px; 
    border-radius: 12px;
    text-align: center; 
    max-width: 90vw; 
    width: 450px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* 🏆 ENFORCED CONTAINER HEIGHT FOR CROPPER GRID */
.img-container { 
    width: 100%;
    max-height: 400px; 
    overflow: hidden;
    background-color: #f7f7f7;
    margin-bottom: 20px;
    display: block;
}

#imageToCrop { 
    display: block;
    max-width: 100%; 
}

/* 🏆 CIRCULAR CROP VISUAL FIX */
.cropper-view-box, .cropper-face { 
    border-radius: 50%; 
}

/* 🏆 THE STICKY FOOTER */
.site-footer {
    background-color: #2c3e50;
    padding: 40px 20px;
    text-align: center;
    color: #bdc3c7;
    font-size: 14px;
    width: 100%;
    align-self: stretch; 
    margin-top: auto;    
    box-sizing: border-box;
}

.site-footer a {
    transition: color 0.2s;
}

.site-footer a:hover {
    color: #ffffff !important;
}

/* Extra formatting for the legal/text pages */
.page-content { background: white; padding: 40px; border-radius: 12px; max-width: 800px; width: 100%; box-shadow: 0 4px 12px rgba(0,0,0,0.05); margin: 40px auto; }
.page-content h2 { color: #2c3e50; margin-top: 30px; }
.page-content p, .page-content li { line-height: 1.6; color: #555; }