/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2d2d2d;
    --primary-hover: #1a1a1a;
    --secondary-color: #6b6b6b;
    --success-color: #4a4a4a;
    --danger-color: #5a5a5a;
    --border-color: #e0e0e0;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --text-primary: #2d2d2d;
    --text-secondary: #6b6b6b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: 80px;
}

/* 네비게이션 바 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    margin-left: auto;
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.nav-toggle .bar {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    margin: 3px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.is-active .bar:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}

.nav-toggle.is-active .bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-active .bar:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
}

/* 고정형 쿠팡 광고 */
.coupang-side-ad {
    position: fixed;
    top: 150px;
    left: 15px;
    width: 140px;
    z-index: 200;
    display: none;
}

@media (min-width: 1280px) {
    body {
        padding-left: 180px;
    }

    .coupang-side-ad {
        display: block;
    }
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-brand a:hover {
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    padding: 10px 15px;
    border-radius: var(--radius);
    transition: all 0.3s ease;
    display: block;
}

.nav-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

/* 드롭다운 메뉴 */
.dropdown,
.nav-item.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    list-style: none;
    min-width: 200px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.dropdown:hover .dropdown-menu,
.nav-item.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.dropdown-menu a:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

body.nav-open {
    overflow: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* 헤더 */
header {
    background: linear-gradient(135deg, #3a3a3a 0%, #2d2d2d 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 메인 컨텐츠 */
main {
    padding: 30px;
}

.generator-section {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
    margin-bottom: 50px;
}

/* 컨트롤 패널 */
.controls-panel {
    background: var(--bg-light);
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

/* 폼 그룹 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: var(--bg-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    resize: vertical;
    font-family: 'Courier New', monospace;
}

.helper-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.char-count {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* 옵션 섹션 */
.options-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-group span {
    font-weight: 500;
}

/* 레인지 슬라이더 */
.range-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.range-control {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.range-control::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.range-control::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-hover);
}

.range-control::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.range-control::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-hover);
}

/* 색상 선택 */
.color-group {
    display: flex;
    flex-direction: column;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-wrapper input[type="color"] {
    width: 60px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
}

.color-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 버튼 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
    margin-top: 15px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-reset {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 100%;
    margin-top: 15px;
}

.btn-reset:hover {
    background: var(--bg-light);
    border-color: var(--text-secondary);
}

/* 출력 패널 */
.output-panel {
    background: var(--bg-white);
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.barcode-preview {
    background: var(--bg-light);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.barcode-preview svg {
    max-width: 100%;
    height: auto;
}

.output-controls {
    margin-top: 20px;
}

.display-value-text {
    text-align: center;
    padding: 15px;
    background: var(--bg-light);
    border-radius: var(--radius);
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.error-message {
    background: #f0f0f0;
    color: #5a5a5a;
    padding: 12px;
    border-radius: var(--radius);
    margin-top: 15px;
    font-size: 0.9rem;
    border-left: 4px solid #6b6b6b;
}

/* 정보 섹션 */
.info-section {
    margin-top: 50px;
    padding-top: 50px;
    border-top: 2px solid var(--border-color);
}

.info-section h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
}

.info-card {
    background: var(--bg-light);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.info-card h3 {
    font-size: 1.3rem;
    color: #2d2d2d;
    margin-bottom: 15px;
}

.info-card p,
.info-card li {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 10px;
}

.info-card ul,
.info-card ol {
    margin-left: 20px;
}

.info-card li {
    margin-bottom: 8px;
}

/* 푸터 */
footer {
    background: var(--bg-light);
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

/* 소셜 링크 숨김 */
.social-links {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.social-links a {
    display: inline-block;
    margin: 0 5px;
}

/* 광고 배너 스타일 */
.ad-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

/* PC에서만 표시 */
.ad-desktop {
    display: flex;
}

/* 모바일에서만 표시 */
.ad-mobile {
    display: none;
}

/* 반응형 디자인 */
@media (max-width: 1024px) {
    .nav-container {
        padding: 0 20px;
        flex-wrap: wrap;
        height: auto;
        gap: 10px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
        display: none;
        border-top: 1px solid var(--border-color);
        padding-top: 10px;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        padding: 12px 10px;
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        border: none;
        box-shadow: none;
        padding: 0 0 10px 15px;
        margin-top: -5px;
    }

    .dropdown-menu a {
        padding: 8px 0;
    }

    .generator-section {
        grid-template-columns: 1fr;
    }
    
    .controls-panel {
        order: 2;
    }
    
    .output-panel {
        order: 1;
    }
    
    /* PC 광고 숨기기 */
    .ad-desktop {
        display: none;
    }
    
    /* 모바일 광고 표시 */
    .ad-mobile {
        display: flex;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header .subtitle {
        font-size: 1rem;
    }
    
    main {
        padding: 20px;
    }
    
    .controls-panel,
    .output-panel {
        padding: 20px;
    }
    
    .info-section h2 {
        font-size: 1.5rem;
    }
    
    .info-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 30px 20px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    main {
        padding: 15px;
    }
    
    .barcode-preview {
        padding: 20px;
        min-height: 200px;
    }
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.barcode-preview svg {
    animation: fadeIn 0.3s ease-in;
}

/* 프린트 스타일 */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .container {
        box-shadow: none;
    }
    
    .controls-panel,
    .info-section,
    footer,
    .btn {
        display: none;
    }
    
    .generator-section {
        grid-template-columns: 1fr;
    }
    
    .barcode-preview {
        border: none;
        background: white;
    }
}
