@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #111827; 
    --primary-hover: #374151;
    --bg-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --danger: #DC2626;
    --danger-hover: #B91C1C;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 0;
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 1700px;
    padding: 0 2rem;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

.header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* View Navigation */
.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}
.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.view-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.content-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.upload-form {
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #374151;
}

input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    border-color: #9CA3AF;
    box-shadow: 0 0 0 1px #9CA3AF;
}

.template-info {
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #4B5563;
}

.template-info p {
    margin: 0.25rem 0;
}

.template-info code {
    background: #E5E7EB;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
}

.file-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border: 1px dashed #9CA3AF;
    border-radius: 6px;
    cursor: pointer;
    background: #FAFAFA;
    transition: border-color 0.2s;
}

.file-label:hover {
    border-color: #6B7280;
}

#fileName {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

button {
    font-family: inherit;
}

.btn-primary, .btn-danger, .btn-info, .btn-secondary, .btn-success {
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.5rem 1rem;
}

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

.btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

.btn-info { 
    background: white; 
    border-color: #D1D5DB; 
    color: #374151; 
}
.btn-info:hover { background: #F3F4F6; }

.btn-success {
    background: #059669; color: white;
    color: white;
}
.btn-success:hover { background: #047857; }

.btn-danger { 
    background: white; 
    border-color: #FECACA; 
    color: var(--danger); 
}
.btn-danger:hover { background: #FEF2F2; }

.btn-secondary {
    background: white;
    color: #374151;
    border-color: #D1D5DB;
}
.btn-secondary:hover { background: #F3F4F6; }

.message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid transparent;
    max-width: 600px;
}

.message.hidden { display: none; }
.message.success { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }
.message.error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }

/* Table Styles */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 1000px;
    table-layout: fixed;
}

/* 1: 순서, 2: 단원, 3: 유형, 4: 단어, 5: 뜻, 6: 예문, 7: 발음기호, 8: 소리주소, 9: 관리 */
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 4%; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 9%; }
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 4%; }
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 12%; }
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 23%; }
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 23%; }
.data-table th:nth-child(7), .data-table td:nth-child(7) { width: 8%; }
.data-table th:nth-child(8), .data-table td:nth-child(8) { width: 8%; }
.data-table th:nth-child(9), .data-table td:nth-child(9) { width: 9%; }

.data-table th, .data-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

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

.data-table th {
    background: #F9FAFB;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.data-table td {
    color: #111827;
    vertical-align: middle;
}

.action-buttons {
    white-space: nowrap;
}
.action-buttons button {
    margin-right: 0.4rem;
}

.edit-input {
    width: 100%;
    padding: 0 0.3rem;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    box-sizing: border-box;
    height: 20px;
    margin: -2px 0;
}

.link-btn {
    background: none;
    border: none;
    color: #2563EB;
    cursor: pointer;
    font-weight: 600;
    padding: 0;
}
.link-btn:hover {
    text-decoration: underline;
}

.form-row {
    display: flex;
    gap: 0.5rem;
}
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
