:root {
    --primary: #8b5a2b;
    --primary-hover: #6d4620;
    --bg: #f5f0e6;
    --card: #fffbf5;
    --text: #3d3229;
    --text-muted: #8b7355;
    --border: #e8e0d0;
    --success: #6b8e4e;
    --warning: #c9a227;
    --error: #b85450;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

section {
    background: var(--card);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.file-input-group {
    margin-bottom: 1.5rem;
}

.file-input-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

input[type="file"] {
    display: none;
}

.file-name {
    display: inline-block;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    color: var(--text-muted);
    transition: all 0.2s;
}

.file-name:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.file-name.has-file {
    border-style: solid;
    border-color: var(--success);
    color: var(--text);
    background: #f0fdf4;
}

.hint {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

h3 {
    margin: 1.5rem 0 0.75rem;
    font-size: 1rem;
}

h3:first-child {
    margin-top: 0;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.radio-group label:hover {
    background: var(--bg);
}

input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-weight: normal;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}

.action-section {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

button, .btn-primary {
    flex: 1;
    min-width: 120px;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.results-section {
    border-left: 4px solid var(--primary);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--bg);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-number.success { color: var(--success); }
.stat-number.warning { color: var(--warning); }

.preview {
    max-height: 300px;
    overflow-y: auto;
    background: var(--bg);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.preview h4 {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.book-list {
    list-style: none;
}

.book-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.book-item:last-child {
    border-bottom: none;
}

.book-item.duplicate {
    color: var(--error);
    opacity: 0.7;
}

.book-title {
    font-weight: 500;
    flex: 1;
}

.book-isbn {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.8rem;
}

.download-area {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 2rem;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .action-section {
        flex-direction: column;
    }
}

/* Hamburger Menu */
.hamburger {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    min-width: auto;
    flex: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    z-index: 1100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0;
}

.hamburger span {
    width: 20px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s;
    border-radius: 2px;
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--card);
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 1200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mobile-nav.open {
    right: 0;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.nav-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.close-nav {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    width: auto;
}

.mobile-nav ul {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

.mobile-nav li a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.mobile-nav li a:hover {
    background: var(--bg);
}

.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.nav-overlay.open {
    opacity: 1;
    visibility: visible;
}