:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --success-color: #10b981;
    --error-color: #ef4444;
    --background: #ffffff;
    --surface: #f9fafb;
    --border: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
header {
    text-align: center;
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 3rem;
}

/* Content with Ad Layout */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 2rem;
    align-items: start;
}

/* Ad Sidebar */
.ad-sidebar {
    position: sticky;
    top: 1rem;
    min-height: 600px;
}

/* Bottom Banner Ad */
.bottom-ad-container {
    margin: 2rem auto;
    text-align: center;
    padding: 0 1rem;
}

.bottom-ad-container.desktop-ad {
    max-width: 728px;
    min-height: 90px;
}

.bottom-ad-container.mobile-ad {
    max-width: 320px;
    min-height: 50px;
    display: none; /* Hidden by default, shown on mobile */
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.ko {
    font-family: 'Noto Sans KR', sans-serif;
}

.en {
    font-size: 0.9em;
}

/* Language visibility control */
body[data-lang="ko"] .en {
    display: none;
}

body[data-lang="en"] .ko {
    display: none;
}

body[data-lang="en"] .en {
    font-size: 1em;
}

/* Fix button text color for language-specific text inside buttons */
.btn-primary .en,
.btn-primary .ko {
    color: white;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Main Layout */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

@media (min-width: 1024px) {
    main {
        grid-template-columns: 1fr 1fr;
    }
}

/* Responsive: Stack layout on smaller screens */
@media (max-width: 1200px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .ad-sidebar {
        display: none;
    }
}

/* Upload Areas Container */
.upload-areas-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Upload Area */
.upload-area {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    transform: scale(1.02);
}

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

.upload-text {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Progress Bar */
.progress-container {
    margin: 2rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* File List */
.file-list {
    margin: 2rem 0;
}

.file-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.file-item.folder-item {
    background: linear-gradient(135deg, var(--surface) 0%, rgba(37, 99, 235, 0.05) 100%);
    border: 2px solid var(--primary-color);
}

.file-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    word-break: break-all;
}

.file-name.original {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.file-name.normalized {
    color: var(--success-color);
    margin-top: 0.25rem;
}

.file-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 2rem;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    min-height: 400px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Content Styles */
h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.example-box, .info-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.example-box h3 {
    margin-bottom: 0.5rem;
}

.info-box {
    background: rgba(37, 99, 235, 0.05);
    border-color: rgba(37, 99, 235, 0.2);
}

.steps {
    counter-reset: step-counter;
    margin: 1rem 0;
}

.steps li {
    counter-increment: step-counter;
    margin-bottom: 1rem;
    padding-left: 2rem;
    position: relative;
}

.steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--primary-color);
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

/* FAQ */
.faq-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

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

.faq-item h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* Docs Links */
.docs-links {
    display: grid;
    gap: 1rem;
}

.doc-link {
    display: block;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.doc-link:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.doc-link h3 {
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.doc-link p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--background);
    margin: 2% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-close {
    color: var(--text-secondary);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    margin-top: 2rem;
}

/* Markdown Content */
.modal-body h1,
.modal-body h2,
.modal-body h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.modal-body p {
    margin-bottom: 1rem;
}

.modal-body ul,
.modal-body ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.modal-body code {
    background: var(--surface);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.modal-body pre {
    background: var(--surface);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.modal-body th,
.modal-body td {
    border: 1px solid var(--border);
    padding: 0.5rem;
    text-align: left;
}

.modal-body th {
    background: var(--surface);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Header Layout */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.title-section {
    flex: 1;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Language Selector */
.language-selector {
    display: flex;
    background: var(--surface);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.lang-btn:hover {
    color: var(--text-primary);
}

.lang-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Bookmark Button */
.btn-bookmark {
    background: #fff;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-bookmark:hover {
    background: var(--primary-color);
    color: white;
}

.bookmark-icon {
    font-size: 1.1rem;
}

/* Install App Button */
.btn-install {
    background: var(--success-color);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-install:hover {
    background: #059669;
}

.install-icon {
    font-size: 1.1rem;
}

/* Bookmark Modal */
.bookmark-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.bookmark-modal-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.bookmark-modal-content h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.bookmark-shortcut {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.bookmark-shortcut strong {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.browser-instructions {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.browser-instructions .ko,
.browser-instructions .en {
    display: block;
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .upload-areas-container {
        grid-template-columns: 1fr;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    /* Hide desktop ad on mobile, show mobile ad */
    .bottom-ad-container.desktop-ad {
        display: none;
    }
    
    .bottom-ad-container.mobile-ad {
        display: block;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-actions {
        justify-content: center;
    }
}