/* static/css/style.css (Refactored for common styles) */

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #111827; /* dark-bg */
    color: #e5e7eb; /* text-gray-200 */
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Header & Hamburger Menu --- */
header {
    background-color: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #374151;
    position: sticky; 
    top: 0;
    z-index: 50;
}
header button, header a { 
    font-weight: 700; 
    color: #ffffff; 
}


/* --- Left Side Menu --- */
#side-menu {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 80%;
    max-width: 280px;
    background-color: #1f2937; /* slate-800 */
    padding: 1.5rem;
    box-shadow: 5px 0 15px rgba(0,0,0,0.3);
    z-index: 1001; /* Higher than header */
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}
.side-menu-closed {
    transform: translateX(-100%);
}
.side-menu-open {
    transform: translateX(0);
}
#menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}
.menu-item {
    margin-bottom: 1.5rem;
}
.menu-label {
    display: block;
    margin-bottom: 0.75rem;
    color: #9ca3af; /* gray-400 */
    font-size: 0.875rem;
    font-weight: bold;
}
.mode-select-btn {
    display: flex; /* ADDED: to align text and status label */
    justify-content: space-between; /* ADDED: to push status to the right */
    align-items: center; /* ADDED: to vertically align */
    text-align: left;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background-color: #374151;
    color: #d1d5db;
    transition: background-color 0.2s;
    font-weight: 500;
}

.mode-select-btn:hover {
    background-color: #4b5563;
}
.mode-select-btn.active {
    background-color: #8b5cf6;
    color: white;
    font-weight: bold;
}

.stone-research-btn {
    display: flex; /* MODIFIED: to align text and status label */
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: #9ca3af;
    border: 1px solid #4b5563;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}
.stone-research-btn:hover {
    background-color: #4b5563;
    color: #ffffff;
}

/* --- Language Buttons in Header --- */
#header-lang-buttons .lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem; /* 36px */
    height: 2.25rem; /* 36px */
    padding: 0.5rem;
    border-radius: 0.375rem; /* rounded-md */
    background-color: #374151;
    color: #d1d5db;
    font-size: 0.875rem; /* text-sm */
    font-weight: 700;
    transition: background-color 0.2s;
    text-decoration: none;
}
#header-lang-buttons .lang-btn:hover {
    background-color: #4b5563;
}
#header-lang-buttons .lang-btn.active {
    background-color: #8b5cf6;
    color: white;
}

/* --- Disabled Button Styles & Status Label --- */
.mode-select-btn.disabled,
.stone-research-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}
.status-label {
    font-size: 0.75rem; /* 12px */
    font-weight: 400;
    color: #f59e0b; /* amber-500 */
}


/* --- Typography & General --- */
h1, h2, h3 { font-weight: 700; color: #FFFFFF; }
.hidden { display: none; }
#faceOverlayCanvas { 
    pointer-events: none; 
    position: absolute; 
    top: 0; 
    left: 0; 
    z-index: 5; 
}


/* --- Drop Zone --- */
#drop-zone {
    background-color: rgba(31, 41, 55, 0.5);
    border: 2px dashed #4b5563;
    border-radius: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}
#drop-zone:hover, #drop-zone.dragover {
    border-color: #8b5cf6; /* violet-500 */
    background-color: rgba(55, 65, 81, 0.7);
}
#drop-zone svg { color: #9ca3af; }


/* --- Image Preview & Loading Effect --- */
#image-wrapper { 
    position: relative; /* Crucial for overlay positioning */
}

#image-preview {
    border-radius: 0.5rem;
    transition: filter 0.3s ease-in-out;
    cursor: pointer;
    max-width: 100%; 
    height: auto;
    display: block; 
}

#image-preview.image-blurred {
    filter: brightness(0.5);
}

.loading-overlay {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    display: flex;
    flex-direction: column; 
    justify-content: center; 
    align-items: center;
    border-radius: 0.5rem;
    z-index: 10;
    color: white;
}

.loading-overlay p {
    margin-top: 1rem;
    font-weight: 600;
    color: #FFFFFF !important;
    text-shadow: 0 0 8px rgba(0,0,0,0.7);
}


/* --- Buttons (Common Styles) --- */
.analyze-btn, .share-btn, .retest-btn, .person-copy-link-btn {
    border: none;
    border-radius: 9999px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
    transition: all 0.3s ease;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap; 
}
.analyze-btn:hover, .share-btn:hover, .retest-btn:hover, .person-copy-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3);
}
.analyze-btn, .share-btn, .person-copy-link-btn {
    background: linear-gradient(90deg, #8b5cf6, #4f46e5);
    color: white;
}
#analyze-btn:disabled {
    background: #374151;
    cursor: not-allowed;
    opacity: 0.5;
}
.retest-btn {
    background-color: #374151;
    color: #e5e7eb;
}


/* --- Footer --- */
.site-footer {
    max-width: 900px;
    margin: 10px auto 0 auto;
    padding: 20px 15px;
    text-align: left;
    border-top: 1px solid #374151;
}

.site-footer p {
    font-size: 0.5rem;
    color: #9ca3af; 
    line-height: 1.7;
}

.site-footer strong {
    color: #d1d5db;
    font-weight: 60;
    display: block;
    margin-bottom: 2px;
    font-size: 0.6rem;
}

/* --- Per-person Action Buttons (Inside result box) --- */
.person-action-buttons {
    border-top: 1px solid #4b5563; /* slate-600 */
    padding-top: 1rem;
    margin-top: 1.5rem;
}


/* --- Screenshot Staging Area --- */
#screenshot-staging-area {
    position: absolute;
    left: -9999px; 
    top: 0;
    width: 1080px;
    height: auto; 
    min-height: 1600px;
    background-color: #111827; 
    display: flex;
    flex-direction: column; 
    justify-content: flex-start;
    align-items: center;
    padding: 60px;
    box-sizing: border-box;
    font-family: 'Noto Sans KR', sans-serif;
    color: #e5e7eb;
}

#screenshot-title-header {
    flex: 0 0 auto; 
    width: 100%;
    text-align: center;
    font-size: 64px;
    font-weight: bold;
    color: #FFFFFF;
    margin-bottom: 40px;
}

#screenshot-image-col {
    flex: 0 0 auto; 
    margin-bottom: 40px;
}

#screenshot-image-col img {
    max-width: 100%;
    height: auto;
    border-radius: 1.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    object-fit: contain;
}

#screenshot-results-col {
    flex: 0 0 auto;
    width: 100%;
    padding: 0;
}

#screenshot-results-col .person-result-container {
    margin-bottom: 40px;
}
#screenshot-results-col .person-action-buttons {
    display: none;
}

#screenshot-results-col .result-box {
    background: none;
    border: none;
    padding: 2.5rem 0 0 0;
    box-shadow: none;
    border-top: 2px solid #4b5563;
    margin-top: 2rem;
}

#screenshot-results-col h2 { /* Person 1, etc. */
    font-size: 44px;
    word-break: break-word; 
    text-align: center;
    line-height: 1.4; 
}
#screenshot-results-col h3 { /* Result Box Title e.g. "추정 혈통" */
    font-size: 42px;
    margin-bottom: 2rem;
    padding-bottom: 0;
    border-bottom: none;
    text-align: center; 
    width: 100%; 
    display: block;
}
#screenshot-results-col .result-item {
    margin-bottom: 1.5rem;
}
#screenshot-results-col .result-item-info {
    font-size: 34px;
}
#screenshot-results-col .nationality-prob {
    font-size: 36px;
}
#screenshot-results-col .bar-container { 
    display: block !important; 
    background-color: #374151;
    border-radius: 9999px;
    height: 10px;
    overflow: hidden;
}


#screenshot-results-col .reason-section {
    border-top-width: 2px;
    margin-top: 2rem;
    padding-top: 2rem;
}
#screenshot-results-col .reason-section h3 {
    font-size: 40px;
    border-bottom: none;
    margin-bottom: 1.5rem;
}
#screenshot-results-col .reason-section p {
    font-size: 28px;
    line-height: 1.7;
    text-align: left;
    margin-bottom: 1rem;
}
#screenshot-results-col .reason-section p strong {
    font-size: 30px;
}
#screenshot-results-col .reason-section em {
    font-size: 24px;
}

#screenshot-watermark {
    position: absolute; 
    bottom: 30px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.5);
}

/* FIX: Disable bar animation for screenshotting to ensure it renders correctly */
#screenshot-staging-area .bar {
    transition: none !important;
}