/* === Base Reset & Variables === */
:root {
    --primary: #8B5CF6;
    --primary-dark: #7C3AED;
    --secondary: #EC4899;
    --accent: #06B6D4;
    --bg-dark: #0F0A1A;
    --bg-card: rgba(255, 255, 255, 0.05);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.3);
    --border-radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', 'Noto Sans KR', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* === Background Effects === */
.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
    z-index: -2;
}

.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    top: 50%;
    right: -100px;
    animation-delay: -5s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: var(--accent);
    bottom: -50px;
    left: 30%;
    animation-delay: -10s;
}

.shape-4 {
    width: 200px;
    height: 200px;
    background: #F59E0B;
    top: 30%;
    left: 50%;
    animation-delay: -15s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(50px, 50px) rotate(90deg); }
    50% { transform: translate(0, 100px) rotate(180deg); }
    75% { transform: translate(-50px, 50px) rotate(270deg); }
}

/* === Container === */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
}

/* === Header === */
header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out;
}

.title {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(2rem, 8vw, 3.5rem);
    line-height: 1.3;
    margin-bottom: 20px;
    text-shadow: 0 0 40px rgba(139, 92, 246, 0.5);
}

.title-emoji {
    display: inline-block;
    animation: bounce 2s infinite;
}

.highlight {
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

.subtitle-kr {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 8px;
    font-family: 'Noto Sans KR', sans-serif;
}

/* Korean sub-labels */
.label-kr, .section-kr, .result-kr {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'Noto Sans KR', sans-serif;
    margin-top: 4px;
    font-weight: 400;
}

.section-kr {
    display: inline;
    margin-left: 8px;
    font-size: 0.85rem;
}

.result-kr {
    display: inline;
    margin-left: 6px;
    font-size: 0.8rem;
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* === Ad Container & Placeholder === */
.ad-container {
    margin: 30px 0;
    min-height: 100px;
}

.ad-placeholder {
    background: var(--bg-card);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* AdSense 반응형 스타일 */
.adsbygoogle {
    display: block;
    width: 100%;
}

/* === Input Section === */
.input-section {
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

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

.search-box {
    margin-bottom: 30px;
}

.search-box label {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper input {
    width: 100%;
    padding: 18px 50px 18px 24px;
    font-size: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.search-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.search-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #1a1225;
    border-radius: 16px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 14px 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(139, 92, 246, 0.2);
}

.search-result-item .idol-emoji {
    font-size: 1.5rem;
}

.search-result-item .idol-details {
    flex: 1;
}

.search-result-item .idol-details strong {
    display: block;
    font-size: 1rem;
}

.search-result-item .idol-details span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === Popular Idols === */
.popular-idols {
    margin-bottom: 30px;
}

.popular-idols h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.idol-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.idol-chip {
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.idol-chip:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* === Selected Idol Card === */
.selected-idol {
    margin: 30px 0;
    animation: fadeInUp 0.5s ease-out;
}

.idol-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(10px);
}

.idol-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-glow);
}

.idol-info h2 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.idol-info p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.idol-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.idol-tag {
    padding: 4px 12px;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--primary);
}

/* === Birthdate Section === */
.birthdate-section {
    margin: 30px 0;
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.birthdate-section h3 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.birthdate-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.birthdate-inputs {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.birthdate-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.birthdate-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.birthdate-group select {
    padding: 14px 20px;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    min-width: 100px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.birthdate-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.birthdate-group select option {
    background: #1a1225;
    color: var(--text-primary);
}

/* === Gender Select === */
.gender-select {
    margin: 30px 0;
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.gender-select h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.gender-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.gender-btn {
    padding: 16px 30px;
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}

.gender-btn:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.gender-btn.active {
    background: var(--gradient-1);
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.gender-icon {
    font-size: 1.3rem;
}

/* === Generate Button === */
.generate-btn {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 40px auto;
    padding: 20px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    background: var(--gradient-2);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.4);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.generate-btn.loading .btn-text {
    opacity: 0;
}

.generate-btn.loading .btn-loader {
    display: block;
}

.btn-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* === Result Section === */
.result-section {
    animation: fadeInUp 0.8s ease-out;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    text-align: center;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-2);
}

.result-header {
    margin-bottom: 20px;
}

.result-label {
    font-size: 1rem;
    color: var(--text-secondary);
}

.result-name-container {
    margin: 30px 0;
}

.result-name {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(2.5rem, 10vw, 4rem);
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 10px rgba(79, 172, 254, 0.5)); }
    to { filter: drop-shadow(0 0 30px rgba(79, 172, 254, 0.8)); }
}

.result-name-hanja {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.result-meaning, .result-chemistry, .result-destiny {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.result-meaning h4, .result-chemistry h4, .result-destiny h4 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--accent);
}

.result-destiny h4 {
    color: #F59E0B;
}

.result-meaning p, .result-chemistry p, .result-destiny p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.result-compatibility {
    margin: 30px 0;
}

.compatibility-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.compatibility-fill {
    height: 100%;
    background: var(--gradient-2);
    border-radius: 6px;
    width: 0%;
    transition: width 1.5s ease-out;
}

.compatibility-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary);
}

/* === Result Actions === */
.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.share-btn, .retry-btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-weight: 500;
}

.share-btn {
    background: var(--gradient-1);
    border: none;
    color: white;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(139, 92, 246, 0.4);
}

.retry-btn {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.retry-btn:hover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

/* === Other Names === */
.other-names {
    margin-top: 40px;
}

.other-names h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.other-names-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.other-name-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.other-name-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.other-name-card h4 {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.other-name-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === Coupang Section === */
.coupang-section {
    margin-top: 40px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
}

.coupang-section h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.coupang-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.coupang-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    margin: 16px 0;
}

.coupang-disclosure {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* === Footer === */
footer {
    text-align: center;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

/* === Responsive === */
@media (max-width: 600px) {
    .container {
        padding: 20px 15px;
    }

    .idol-card {
        flex-direction: column;
        text-align: center;
    }

    .idol-tags {
        justify-content: center;
    }

    .gender-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .gender-btn {
        justify-content: center;
    }

    .result-actions {
        flex-direction: column;
    }

    .share-btn, .retry-btn {
        width: 100%;
    }
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.7);
}
