/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

header .subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Main content */
main {
    flex: 1;
    padding: 2rem 0;
}

/* Upload section */
.upload-section {
    margin-bottom: 2rem;
}

.upload-zone {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

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

.upload-text {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

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

.upload-options {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-color);
}

/* Preview section */
.preview-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.preview-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.preview-content {
    text-align: center;
}

#previewImage {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.pdf-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    background: #f1f5f9;
    border-radius: 8px;
}

.pdf-icon {
    font-size: 2rem;
}

/* Loading section */
.loading-section {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result section */
.result-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.result-header h2 {
    font-size: 1.25rem;
}

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

/* Data table */
.result-table h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table tr {
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:last-child {
    border-bottom: none;
}

.data-table th,
.data-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    width: 35%;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.data-table td {
    font-weight: 500;
}

.account-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.account-list li {
    padding: 0.25rem 0;
}

.account-list li:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

/* JSON view */
.json-view {
    margin-top: 1.5rem;
    background: #1e293b;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
}

.json-view pre {
    color: #e2e8f0;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Raw text section */
.raw-text-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.raw-text-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.raw-text-section pre {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* Processing info */
.processing-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Error section */
.error-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

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

.error-section h3 {
    color: var(--error-color);
    margin-bottom: 0.5rem;
}

.error-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

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

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

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

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

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

/* Utility classes */
.hidden {
    display: none !important;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* Footer */
footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

/* Responsive */
@media (max-width: 600px) {
    header {
        padding: 1.5rem 0;
    }

    header h1 {
        font-size: 1.5rem;
    }

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

    .upload-options {
        flex-direction: column;
        gap: 0.75rem;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .data-table th,
    .data-table td {
        display: block;
        width: 100%;
        padding: 0.5rem;
    }

    .data-table th {
        padding-bottom: 0;
        font-size: 0.85rem;
    }

    .data-table td {
        padding-top: 0.25rem;
        padding-bottom: 0.75rem;
    }
}
