/* ========================================
   전역 스타일 및 CSS 변수
   ======================================== */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 16px;
}

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

body {
    font-family: 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   배경 애니메이션
   ======================================== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 500px;
    height: 500px;
    top: -250px;
    right: -250px;
    animation-delay: 0s;
}

.circle-2 {
    width: 400px;
    height: 400px;
    bottom: -200px;
    left: -200px;
    animation-delay: 7s;
}

.circle-3 {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(50px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-50px, 50px) scale(0.9);
    }
}

/* ========================================
   헤더 & 네비게이션
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    text-decoration: none;
}

.logo i {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Left group: logo + visitor stats to keep consistent spacing */
.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Visitor stats in header */
.visitor-stats {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: 1rem;
}

.visitor-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    /* stronger contrast so it stands out from header */
    background: linear-gradient(90deg, rgba(99,102,241,0.18), rgba(236,72,153,0.12));
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-primary);
    font-size: 0.95rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 18px rgba(2,6,23,0.55);
}

.visitor-stats .stat .label {
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    margin-right: 0.45rem;
    font-size: 0.82rem;
    opacity: 0.95;
}

.visitor-stats .stat .value {
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 0 rgba(0,0,0,0.3);
}

.visitor-stats .sep {
    color: rgba(255,255,255,0.2);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .visitor-stats { display: none; }
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    display: block;
    padding: 0.5rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: var(--transition);
}

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

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

/* 드롭다운 메뉴 */
.dropdown {
    position: relative;
}

.dropdown > a {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 200px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    padding: 0.75rem 1.5rem;
    display: block;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.dropdown-menu a::after {
    display: none;
}

.dropdown-menu a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
    padding-left: 2rem;
}

/* ========================================
   메인 컨테이너
   ======================================== */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem 2rem;
}

/* ========================================
   히어로 섹션
   ======================================== */
.hero-section {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeInUp 0.8s ease-out;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* ========================================
   변환 카드
   ======================================== */
.converter-section {
    margin-bottom: 6rem;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.converter-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.glass {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 업로드 영역 */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 4rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.upload-icon {
    font-size: 5rem;
    color: var(--primary-color);
    animation: bounce 2s infinite;
}

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

.upload-area h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

.upload-area p {
    color: var(--text-muted);
}

/* 버튼 스타일 */
.btn-primary,
.btn-convert,
.btn-download,
.btn-secondary {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-convert {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    width: 100%;
    justify-content: center;
    margin-top: 1.5rem;
}

.btn-convert:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-download {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* 미리보기 영역 */
.preview-area {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.image-preview {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    aspect-ratio: 16/9;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.btn-remove {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: var(--danger-color);
    transform: scale(1.1);
}

/* 이미지 정보 */
.image-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.info-label {
    color: var(--text-muted);
    font-weight: 600;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* 변환 옵션 */
.conversion-options {
    background: rgba(255, 255, 255, 0.03);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.conversion-options h4 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.format-selector,
.quality-selector {
    margin-bottom: 1.5rem;
}

.format-selector label,
.quality-selector label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.format-select {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: #222;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.format-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.quality-input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#qualitySlider {
    flex: 1;
    height: 6px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
}

#qualitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

#qualitySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

#qualityInput {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    text-align: center;
    font-size: 1rem;
}

#qualityInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 프로그레스 바 */
.progress-container {
    text-align: center;
    padding: 2rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    color: var(--text-secondary);
    font-weight: 600;
}

/* 결과 영역 */
.result-area {
    text-align: center;
    padding: 3rem 0;
}

.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.success-icon {
    font-size: 5rem;
    color: var(--success-color);
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* 숨김 클래스 */
.hidden {
    display: none !important;
}

/* ========================================
   푸터
   ======================================== */
.footer {
    background: rgba(15, 23, 42, 0.8);
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    /* Use same horizontal layout as home.css */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 2rem;
}

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

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

/* Processed-data in footer (fragments/processed.html) */
.footer-processed {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.9rem;
    background: linear-gradient(90deg, rgba(99,102,241,0.08), rgba(236,72,153,0.06));
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-secondary);
    font-size: 0.95rem;
    backdrop-filter: blur(6px);
}

.footer-processed .label {
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    font-size: 0.82rem;
}

.footer-processed .value {
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 0 rgba(0,0,0,0.3);
}

/* ========================================
   애니메이션
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   반응형 디자인
   ======================================== */
/* 1단계: 900px 이하 - 방문자 수 숨김 */
@media (max-width: 900px) {
    .visitor-stats {
        display: none;
    }
}

/* 2단계: 900px 이하 - 메뉴 간격 줄이기 */
@media (max-width: 900px) {
    .nav-links {
        gap: 1rem;
        font-size: 0.9rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .logo i {
        font-size: 1.5rem;
    }
}

/* 3단계: 768px 이하 - 로고와 메뉴 더 축소 */
@media (max-width: 768px) {
    .header {
        padding: 0.5rem 0;
    }
    
    .nav-container {
        padding: 0 1rem;
        gap: 0.5rem;
        justify-content: space-between;
        width: 100%;
    }
    
    .logo {
        font-size: clamp(1rem, 4vw, 1.3rem);
        gap: 0.3rem;
        flex: 0 0 auto;
    }
    
    .logo i {
        font-size: clamp(1.2rem, 4.5vw, 1.5rem);
    }
    
    .nav-links {
        gap: clamp(0.5rem, 2vw, 1rem);
        font-size: clamp(0.8rem, 2.5vw, 1rem);
        flex: 1 1 auto;
        justify-content: flex-end;
    }
    
    .nav-links a {
        padding: 0.3rem 0;
        white-space: nowrap;
    }
    
    .dropdown-menu {
        font-size: 0.85rem;
        min-width: 140px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }

    .preview-container {
        grid-template-columns: 1fr;
    }

    .converter-card {
        padding: 2rem;
    }

    .result-buttons {
        flex-direction: column;
        width: 100%;
    }

    .result-buttons button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* 헤더 더 축소 */
    .header {
        padding: 0.4rem 0;
    }
    
    .nav-container {
        padding: 0 0.5rem;
    }
    
    /* 로고 더 작게 */
    .logo {
        font-size: 0.95rem;
        gap: 0.25rem;
    }
    
    .logo i {
        font-size: 1.1rem;
    }
    
    /* 메뉴 더 작게 */
    .nav-links {
        gap: 0.3rem;
        font-size: 0.75rem;
    }
    
    .nav-links a {
        padding: 0.2rem 0;
    }

    .dropdown-menu {
        font-size: 0.8rem;
        min-width: 120px;
        padding: 0.3rem;
    }
    
    .dropdown-menu li a {
        padding: 0.4rem 0.6rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .converter-card {
        padding: 1.5rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .upload-icon {
        font-size: 3rem;
    }
}
