@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --accent-color: #ff9f43;
    /* Added orange accent */
    --light-gray: #f8f9fa;
    --dark-text: #2c3e50;
    --border-radius: 12px;
    --shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    --font-size-base: 1rem;
    --font-size-small: 0.9rem;
    --font-size-large: 1.1rem;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-gray);
    /* Revert to light gray background */
    color: var(--dark-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Adding a subtle background pattern */
    background-image: linear-gradient(45deg, #fdfdfd 25%, transparent 25%, transparent 75%, #fdfdfd 75%, #fdfdfd),
        linear-gradient(45deg, #fdfdfd 25%, transparent 25%, transparent 75%, #fdfdfd 75%, #fdfdfd);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

header {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    /* Beautiful purple gradient */
    color: white;
    text-align: center;
    padding: 3rem 1rem;
    /* Increased padding */
    box-shadow: var(--shadow);
    position: relative;
}

header h1 {
    margin: 0;
    font-size: 2.8rem;
    /* Slightly larger title */
    font-weight: 700;
    letter-spacing: 1px;
}

header p {
    margin: 0.8rem 0 0;
    /* Increased margin */
    font-size: var(--font-size-large);
    font-weight: 300;
}

.language-selector {
    margin-top: 1.5rem;
    /* Increased margin */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    /* Increased gap */
}

.language-selector label {
    font-size: var(--font-size-small);
    font-weight: 400;
}

.custom-dropdown {
    position: relative;
    user-select: none;
}

.dropdown-toggle {
    padding: 0.6rem 1.2rem;
    padding-right: 2.8rem;
    border-radius: 25px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: var(--font-size-small);
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    min-width: 120px;
    position: relative;
}

.chevron-icon {
    position: absolute;
    right: 14px;
    width: 10px;
    height: 10px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
    transform: translateY(-25%) rotate(45deg);
    transition: transform 0.3s ease;
}

.custom-dropdown.active .chevron-icon {
    transform: translateY(25%) rotate(-135deg);
}

.dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: rgba(255, 255, 255, 0.9);
    /* Much more visible background */
    backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 18px;
    padding: 0.5rem;
    margin: 0;
    list-style: none;
    min-width: 140px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 1000;
}

.custom-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu li {
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    color: var(--dark-text);
    /* Changed to dark text for visibility */
    font-size: var(--font-size-small);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.dropdown-menu li:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.02);
}

.dropdown-menu li.selected {
    background-color: rgba(46, 204, 113, 0.1);
    /* Light green background */
    color: #27ae60;
    /* Emerald Green text */
    font-weight: 700;
}

main {
    max-width: 960px;
    /* Slightly wider main content */
    margin: 2.5rem auto;
    /* Increased margin */
    padding: 2rem;
    /* Increased padding */
    flex-grow: 1;
}

.upload-section {
    background-color: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.image-preview-container {
    width: 100%;
    max-width: 400px;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 10px;
    background-color: #fafafa;
    position: relative;
    overflow: hidden;
}

#uploadedImage {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

input[type="file"] {
    display: none;
    /* Hide the actual file input */
}

#upload-image-label {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), #ff4757);
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

#upload-image-label:hover {
    background-color: #e65353;
    /* Slightly darker primary on hover */
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

#resetBtn {
    background-color: #8BC34A;
    /* Light green */
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: var(--font-size-base);
    font-weight: 700;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#resetBtn:hover {
    background-color: #7CB342;
    /* Slightly darker light green */
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.ai-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
    text-align: center;
}

.ai-btn {
    background: linear-gradient(135deg, #FFD700, #FFAE00);
    /* Banana-ish colors */
    color: #333;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 174, 0, 0.3);
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 174, 0, 0.4);
}

.ai-result {
    margin-top: 1.5rem;
    font-style: italic;
    color: #666;
}

#analyzeBtn {
    background: linear-gradient(135deg, var(--secondary-color), #1dd1a1);
    color: white;
    border: none;
    padding: 1.2rem 3rem;
    font-size: var(--font-size-large);
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: fit-content;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.error-message {
    color: #e74c3c;
    /* Red color for error */
    font-size: var(--font-size-small);
    font-weight: 500;
    margin-bottom: 10px;
    /* Space between message and button */
    min-height: 20px;
    /* Reserve space to prevent layout jump */
    display: none;
    /* Hidden by default */
}

#analyzeBtn:hover {
    background-color: #38a79d;
    /* Darker turquoise on hover */
    transform: translateY(-3px);
    /* More pronounced lift effect */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.image-info {
    font-size: var(--font-size-small);
    color: #6c757d;
    margin-top: 1.5rem;
    /* Increased margin */
    background-color: #e6f7ff;
    /* Lighter, more inviting background */
    padding: 1rem 1.5rem;
    /* Adjusted padding */
    border-radius: 8px;
    /* More rounded corners */
    border-left: 5px solid var(--primary-color);
    /* Use primary color for accent */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    /* Subtle shadow */
}

.results-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.analysis-card {
    display: none;
    /* Hidden until analysis results are ready */
    width: 100%;
    max-width: 700px;
}

.result-card {
    background-color: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.image-card {
    display: none;
}

.analysis-card {
    background-color: white;
    border: 1px solid #f1f1f1;
}

.analysis-description {
    background-color: #e8f5e9;
    /* Soft pale green for a fresh, natural feel */
    border-left: 5px solid var(--secondary-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: #2e7d32;
    line-height: 1.7;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.8rem;
    /* Increased padding */
    margin-top: 0;
    font-size: 2rem;
    /* Larger font size */
    font-weight: 600;
}

h3 {
    color: var(--dark-text);
    margin-top: 2rem;
    /* Increased margin */
    font-size: 1.6rem;
    /* Larger font size */
    font-weight: 500;
}

#uploadedImage {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#faceShape {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.3rem;
    /* Larger font size */
}

#recommendations {
    list-style-type: none;
    padding: 0;
}

#recommendations li {
    background: white;
    padding: 1.2rem;
    margin-bottom: 1.2rem;
    border-radius: 10px;
    border-left: 6px solid var(--accent-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    font-size: var(--font-size-base);
    transition: transform 0.2s ease;
    border: 1px solid #eee;
}

#recommendations li:hover {
    transform: translateX(5px);
    border-color: var(--accent-color);
}

#recommendations li strong {
    color: var(--accent-color);
    display: block;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

footer {
    margin-top: 3.5rem;
    /* Increased margin */
    padding: 2rem;
    /* Increased padding */
    background-color: var(--dark-text);
    color: #aeb1b7;
    /* Slightly lighter text for footer */
    text-align: center;
    font-size: var(--font-size-small);
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.05);
    /* Shadow for footer */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.2rem;
    }

    header p {
        font-size: var(--font-size-base);
    }

    .results-wrapper {
        grid-template-columns: 1fr;
    }

    main {
        margin: 1.5rem auto;
        padding: 1rem;
    }

    .upload-section {
        padding: 2rem;
        gap: 1rem;
    }

    input[type="file"] {
        padding: 10px 15px;
    }

    #analyzeBtn {
        padding: 1rem 2rem;
        font-size: var(--font-size-base);
    }

    h2 {
        font-size: 1.6rem;
        padding-bottom: 0.6rem;
    }

    h3 {
        font-size: 1.3rem;
        margin-top: 1.5rem;
    }

    #uploadedImage {
        min-height: 200px;
    }

    .image-info {
        margin-top: 1rem;
        padding: 0.8rem 1rem;
    }

    #recommendations li {
        padding: 1rem;
        margin-bottom: 0.8rem;
    }

    .language-selector {
        margin-top: 1rem;
    }

    footer {
        padding: 1.5rem;
        margin-top: 2rem;
    }
}

footer {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
    /* Inverted header gradient for harmony */
    padding: 4rem 1rem;
    text-align: center;
    border-top: none;
    margin-top: 5rem;
    color: white;
}

.footer-links {
    margin-bottom: 1.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.95rem;
    margin: 0 0.8rem;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.footer-links a:hover {
    color: white;
    border-bottom: 1px solid white;
}

footer p {
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    font-weight: 300;
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }

    header p {
        font-size: 0.9rem;
    }

    .upload-section {
        padding: 1.5rem;
    }

    input[type="file"] {
        width: 90%;
    }

    #analyzeBtn {
        width: 90%;
    }

    main {
        padding: 0.8rem;
    }

    .result-section {
        padding: 1.5rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.1rem;
    }
}