/* Variables */
:root {
    /* Core 12 theme tokens (light/dark pair + active alias) */
    --color-bg-page-light: #f4f7fc;
    --color-bg-page-dark: #10100f;
    --color-surface-light: #ffffff;
    --color-surface-dark: #171717;
    --color-surface-alt-light: #f1f3f4;
    --color-surface-alt-dark: #1d1d1d;
    --color-text-primary-light: #1f2f46;
    --color-text-primary-dark: #edf0f3;
    --color-text-muted-light: #627087;
    --color-text-muted-dark: #c2c8d0;
    --color-border-default-light: #d8e1ef;
    --color-border-default-dark: #2a2a2a;
    --color-primary-light: #4a6da7;
    --color-primary-dark: #3a6fae;
    --color-primary-hover-light: #3a5a8a;
    --color-primary-hover-dark: #2f5f96;
    --color-success-light: #2f936f;
    --color-success-dark: #8ec8a4;
    --color-warning-light: #b07a14;
    --color-warning-dark: #d6b26a;
    --color-danger-light: #c24747;
    --color-danger-dark: #e39c9c;
    --color-focus-ring-light: rgba(74, 109, 167, 0.32);
    --color-focus-ring-dark: rgba(58, 111, 174, 0.4);
    /* Extended 10 (derived from repeated colors in existing pages) */
    --color-surface-soft-light: #f8fbff;
    --color-surface-soft-dark: #1a1a1a;
    --color-surface-raised-light: #fcfdff;
    --color-surface-raised-dark: #202020;
    --color-primary-soft-light: #e8f0fb;
    --color-primary-soft-dark: #1f2731;
    --color-primary-strong-light: #355285;
    --color-primary-strong-dark: #8ba9c9;
    --color-success-soft-light: #e4f7ec;
    --color-success-soft-dark: #1d2b22;
    --color-warning-soft-light: #f5f3ee;
    --color-warning-soft-dark: #2f2a21;
    --color-danger-soft-light: #fff4f4;
    --color-danger-soft-dark: #261a1a;
    --color-info-light: #17a2b8;
    --color-info-dark: #89b6e8;
    --color-code-bg-light: #0f1d31;
    --color-code-bg-dark: #111110;
    --color-overlay-light: rgba(0, 0, 0, 0.12);
    --color-overlay-dark: rgba(0, 0, 0, 0.4);

    --color-bg-page: var(--color-bg-page-light);
    --color-surface: var(--color-surface-light);
    --color-surface-alt: var(--color-surface-alt-light);
    --color-text-primary: var(--color-text-primary-light);
    --color-text-muted: var(--color-text-muted-light);
    --color-border-default: var(--color-border-default-light);
    --color-primary: var(--color-primary-light);
    --color-primary-hover: var(--color-primary-hover-light);
    --color-success: var(--color-success-light);
    --color-warning: var(--color-warning-light);
    --color-danger: var(--color-danger-light);
    --color-focus-ring: var(--color-focus-ring-light);
    --color-surface-soft: var(--color-surface-soft-light);
    --color-surface-raised: var(--color-surface-raised-light);
    --color-primary-soft: var(--color-primary-soft-light);
    --color-primary-strong: var(--color-primary-strong-light);
    --color-success-soft: var(--color-success-soft-light);
    --color-warning-soft: var(--color-warning-soft-light);
    --color-danger-soft: var(--color-danger-soft-light);
    --color-info: var(--color-info-light);
    --color-code-bg: var(--color-code-bg-light);
    --color-overlay: var(--color-overlay-light);

    --primary-color: #4a6da7;
    --primary-light: #e8f0fb;
    --primary-dark: #355285;
    --accent-color: #3a9679;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --box-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
    --transition: all 0.2s ease;
    --card-bg: #ffffff;
    --card-border: #e9ecef;
    --input-border: #ced4da;
    --input-focus: #355285;
    --hover-bg: #f0f4f8;
    --font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

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

.hidden {
    display: none;
}

/* Header Styles */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    box-shadow: var(--box-shadow);
    position: relative;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 2rem;
    gap: 1rem;
}

/* Logo Section */
.logo-section {
    text-align: left;
    cursor: pointer;
    justify-self: start;
}

.logo-section h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.logo-section p {
    font-size: 1.1rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
}

/* Navigation Links */
.nav-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.8rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* User Menu */
.user-menu {
    justify-self: end;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    min-width: 280px;
}

/* Login Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    font-size: 1rem;
    opacity: 0.7;
}

.login-form input {
    width: 100%;
    padding: 10px 10px 10px 36px;
    border: none;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.login-form input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-color);
    background-color: white;
}

.login-form input::placeholder {
    color: #888;
}

.login-btn {
    padding: 10px;
    background-color: var(--accent-color);
    color: var(--text-color);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 5px;
}

.login-btn:hover {
    background-color: #d9a33c;
    transform: translateY(-2px);
}

/* User Info and Actions */
.user-greeting {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    color: white;
}

.user-icon {
    font-size: 1.2rem;
}

#userName {
    font-weight: bold;
    color: var(--accent-color);
}

.user-actions {
    display: flex;
    gap: 10px;
}

.logout-btn,
.admin-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.admin-btn {
    background-color: var(--accent-color);
    color: var(--text-color);
}

.admin-btn:hover {
    background-color: #d9a33c;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.user-info span {
    font-weight: bold;
}

.user-info button {
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.user-info button:hover {
    background-color: #d32f2f;
}

#adminBtn {
    background-color: #2196F3;
}

#adminBtn:hover {
    background-color: #1976D2;
}

footer {
    text-align: center;
    margin-top: 10rem;
    margin-bottom: 10rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

footer p {
    font-size: inherit !important;
}

/* Footer responsive typography */
@media (max-width: 992px) {
    footer {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    footer {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    footer {
        font-size: 0.75rem;
    }
}

/* Search */
.search-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.search-box {
    position: relative;
    width: 80%;
    max-width: 600px;
}

#search {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    background-color: white;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

#search:focus {
    box-shadow: var(--box-shadow-lg);
}

.search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, transform 0.2s;
}

.search-btn:hover {
    background-color: var(--hover-bg);
    transform: translateY(-50%) scale(1.05);
}

.search-content {
    margin-top: 1rem;
}

.search-summary {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--primary-color);
    text-align: center;
}

/* Filter Controls */
.filter-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

.filter-input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 200px;
}

/* Card Components */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Generic Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background-color: #fff;
    color: var(--text-color);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

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

.btn-secondary {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-light);
}

.btn-danger {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.btn-sm {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

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

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow: auto;
    box-shadow: var(--box-shadow-lg);
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
}

.form-row {
    display: grid;
    gap: 10px;
}

.form-row input,
.form-row textarea,
.form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    outline: none;
    transition: var(--transition);
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(53, 82, 133, 0.15);
}

.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
    background-color: var(--primary-color);
    padding: 1rem;
    color: white;
}

.card-body {
    padding: 1.5rem;
    flex-grow: 1;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.card-text {
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Content Containers */
.classic-content {
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.classic-content h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.content-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
}

.classic-content .content-meta {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 25px;
}

/* Text Sections */
.classic-content .text-section {
    margin: 15px 0;
    padding: 18px;
    padding-right: 46px;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    background-color: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
}

.classic-content .text-section:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.text-section {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.text-section:hover {
    background: #f0f0f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content-link-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: 1px solid #d5deea;
    border-radius: 999px;
    background: #f8fafc;
    color: #5a6d86;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.78;
    transition: all 0.18s ease;
}

.content-link-copy-btn svg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    display: block;
    transform: translate(-50%, -50%);
}

.content-link-copy-btn .icon-check {
    display: none;
}

.text-section:hover .content-link-copy-btn,
.content-link-copy-btn:focus-visible {
    opacity: 1;
    border-color: #b9c7dc;
    background: #eef4ff;
    color: #35528a;
}

.content-link-copy-btn.is-copied {
    border-color: #77c08e;
    background: #e8f8ed;
    color: #2f7d4a;
}

.content-link-copy-btn.is-copied .icon-link {
    display: none;
}

.content-link-copy-btn.is-copied .icon-check {
    display: block;
}

.text-section .original-text {
    font-size: 0.9em;
    margin-bottom: 10px;
    color: #333;
}

.text-section .translation-text {
    color: #666;
    font-size: 0.8em;
}

.text-section.dragging {
    opacity: 0.5;
    background-color: #f0f0f0;
}

.text-section.drop-target {
    border: 2px dashed #4CAF50;
}

.text-content {
    margin-top: 10px;
}

.original-text {
    font-size: 1.1em;
    margin-bottom: 5px;
    color: #333;
}

.translation-text {
    color: #666;
}

/* Level Indicators and Controls */
.level-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.edit-mode-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #d6deea;
    border-radius: 999px;
    background: #f7f9fc;
    color: #4b5f7c;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-mode-toggle-btn:hover {
    background: #edf2f9;
    border-color: #c2d0e3;
}

.edit-mode-toggle-btn.is-active {
    background: #e8f2ff;
    border-color: #8db1df;
    color: #2f5d92;
}

.level-badge {
    padding: 3px 8px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.level-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
    font-weight: bold;
    padding: 0;
    line-height: 1;
}

.level-btn:hover {
    background-color: #f5f5f5;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 레벨 증가 버튼 */
.level-btn.level-up-btn {
    background-color: #e8f4fc;
    color: #4a90e2;
    border-color: #c5e0fa;
}

.level-btn.level-up-btn:hover {
    background-color: #d5ebfc;
}

/* 레벨 감소 버튼 */
.level-btn.level-down-btn {
    background-color: #fdf5e8;
    color: #e4a545;
    border-color: #f8e4c5;
}

.level-btn.level-down-btn:hover {
    background-color: #faecd8;
}

.level-btn.level-delete-btn {
    background-color: #fdeeee;
    color: #c95b5b;
    border-color: #f4cccc;
}

.level-btn.level-delete-btn:hover {
    background-color: #fbdede;
}

.level-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Navigation */
.back-to-home,
.back-to-list {
    display: inline-flex;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.back-to-home:hover,
.back-to-list:hover {
    background-color: var(--hover-bg);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

.back-icon {
    margin-right: 8px;
    font-size: 1.2rem;
}

/* back-to-list 기본 화살표는 제거 (Font Awesome 아이콘 사용) */
/*.back-to-list:before { content: "←"; margin-right: 8px; }*/

.book-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    border-top: 1px solid #eee;
    padding-top: 1.5rem;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background-color: var(--hover-bg);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

.prev-btn .nav-icon {
    margin-right: 8px;
}

.next-btn .nav-icon {
    margin-left: 8px;
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin: 20px 0;
    transition: opacity 0.3s;
}

.load-more-container.hidden {
    display: none;
}

/* Repeatable Group Styles */
.repeatable-row {
    border: 1px solid #eee;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    background-color: #fafafa;
    position: relative;
}

.row-header {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px dashed #ddd;
}

.btn-delete-row {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
    padding: 2px 6px;
}

.btn-delete-row:hover {
    color: #dc3545;
}

.btn-add-row {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1rem;
    margin-left: 8px;
    transition: transform 0.2s;
}

.btn-add-row:hover {
    transform: scale(1.1);
}

.no-options {
    padding: 8px;
    color: #999;
    font-size: 0.9rem;
    text-align: center;
}

.load-more-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.load-more-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

/* Highlight Styles */
.highlight {
    background-color: orange;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: bold;
}

.highlighted-match {
    border: 2px solid;
    background-color: #fff8e1;
    scroll-margin-top: 100px;
}

/* Post Editor Styles */
.split-container {
    display: flex;
    height: calc(100vh - 80px);
    overflow: hidden;
    background-color: var(--secondary-color);
}

.post-editor {
    flex: 1.2;
    padding: 25px;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    background-color: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
}

.editor-header h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 0;
}

.editor-content {
    padding: 5px;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    width: 100%;
    margin: 0 0 1rem 0;
    line-height: 1.4;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    background-color: #fff;
}

.post-title:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(78, 122, 81, 0.15);
    outline: none;
}

.post-meta {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.post-content {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    margin-top: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    resize: vertical;
    font-family: 'Noto Sans KR', sans-serif;
    line-height: 1.6;
    transition: all 0.3s ease;
    background-color: #fff;
}

.post-content:focus,
.post-category:focus,
.post-tags:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(78, 122, 81, 0.15);
    outline: none;
}

/* Citation Styles */
.citations-container {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eaeaea;
}

.citations-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3rem;
    color: var(--primary-color);
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.citation-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    margin-bottom: 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.citation-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.citation-content {
    flex: 1;
}

.citation-content .original-text {
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.6;
}

.citation-content .translation-text {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

.remove-citation {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.4em;
    cursor: pointer;
    padding: 0 5px;
    margin-left: 10px;
    transition: transform 0.2s, color 0.2s;
}

.remove-citation:hover {
    color: #c82333;
    transform: scale(1.1);
}

/* Citation Sidebar */
.citations-sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.citation-card {
    padding: 1.8rem;
    margin-bottom: 1.5rem;
    border-top: 4px solid var(--accent-color);
}

.citation-card h3 {
    font-size: 1.15rem;
    color: var(--primary-color);
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #eee;
}

.citation-original {
    color: #333;
    margin-bottom: 0.8rem;
    padding: 0.8rem;
    background-color: #f9f9f9;
    border-radius: 6px;
    font-weight: 500;
}

.citation-translation {
    color: #555;
    padding: 0.8rem;
}

/* Classics List */
.classics-list {
    flex: 1;
    overflow-y: auto;
    background-color: var(--secondary-color);
    padding: 20px 0;
}

.classics-list .container {
    padding: 0 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.classics-list .search-container {
    margin-bottom: 25px;
}

.classics-list .card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    overflow-y: auto;
    padding-bottom: 30px;
}

.list-header {
    margin-bottom: 20px;
}

/* Cite Button */
.cite-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 12px;
    transition: background-color 0.3s, transform 0.2s;
    font-weight: 500;
}

.cite-btn:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
}

/* Post Button */
.post-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: var(--accent-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    height: 35px;
    font-weight: 500;
    margin-left: 10px;
    margin-top: 15px;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.post-btn:hover {
    background-color: #d9a33c;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    color: var(--text-color);
    text-decoration: none;
}

.save-btn {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.save-btn:hover {
    background-color: #45a049;
}

/* Post List Styles */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.post-item {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 3px solid var(--primary-color);
    min-height: 60px;
    position: relative;
}

.post-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.post-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(255, 255, 255, 0) 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.post-item:hover::before {
    opacity: 0.5;
}

.post-item-header {
    margin-bottom: 1.2rem;
    position: relative;
    z-index: 1;
}

.post-item-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.8rem;
    transition: color 0.3s ease;
}

.post-item:hover .post-item-header h2 {
    color: var(--primary-dark);
}

/* Post Categories and Tags */
.post-category {
    color: #666;
    font-size: 0.75rem;
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    height: 1.75rem;
}

.post-tags {
    padding: 0.65rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    flex: 1;
}

.tag {
    background-color: #f2f2f2;
    color: #666;
    padding: 0.35rem 0.7rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.75rem;
    box-sizing: border-box;
}

.tag:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-color);
}

/* Post Meta Information */
.post-meta {
    display: flex;
    gap: 1.2rem;
    font-size: 0.9rem;
    color: #666;
    flex-wrap: wrap;
    align-items: center;
}

.post-author {
    color: #666;
    font-size: 0.85rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    height: 1.75rem;
}



.post-author,
.post-date {
    display: flex;
    align-items: center;
    color: #555;
}

.post-item-content {
    color: #444;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

.post-item-content p {
    margin-bottom: 1.2rem;
}

.post-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex: 1;
    align-items: center;
    min-height: 1.75rem;
}

/* 중복 정의 제거: .tag 및 :hover는 상위 블록에 이미 존재 */

/* 게시글 상세 페이지 스타일 */
.post-detail-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2.5rem;
    margin-top: 2.5rem;
}

.post-detail {
    composes: card;
    padding: 2.5rem;
}

.post-detail-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    position: relative;
}

.post-detail-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background-color: var(--accent-color);
}

.post-detail-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1.2rem;
}

.post-detail-meta {
    display: flex;
    gap: 1.5rem;
    color: #666;
    font-size: 0.95rem;
    flex-wrap: wrap;
}

.post-detail-content {
    line-height: 1.9;
    color: #333;
    font-size: 1.05rem;
}

.post-detail-content p {
    margin-bottom: 1.8rem;
}

/* 인용 사이드바 스타일 */
.citations-sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.citation-card {
    composes: card;
    padding: 1.8rem;
    margin-bottom: 1.5rem;
    border-top: 4px solid var(--accent-color);
}

.citation-card h3 {
    font-size: 1.15rem;
    color: var(--primary-color);
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #eee;
}

.citation-content {
    font-size: 0.95rem;
    line-height: 1.7;
}

.citation-original {
    color: #333;
    margin-bottom: 0.8rem;
    padding: 0.8rem;
    background-color: #f9f9f9;
    border-radius: 6px;
    font-weight: 500;
}

.citation-translation {
    color: #555;
    padding: 0.8rem;
}

/* 노 컨텐츠 스타일 */
.no-results {
    composes: card;
    padding: 3rem 2rem;
    text-align: center;
}

.no-results p {
    color: #666;
    font-size: 1.1rem;
}

/* 반응형 스타일 */
@media (max-width: 992px) {
    .post-detail-container {
        grid-template-columns: 1fr;
    }

    .citations-sidebar {
        position: static;
    }

    .filter-container {
        flex-direction: column;
    }

    .filter-select,
    .filter-input {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 768px) {

    /* 모바일에서 화면 양측에 여백 추가 */
    body {
        padding: 0 0.5rem;
    }

    /* 헤더는 전체 너비로 표시 (body padding 무시) */
    header {
        margin: 0 -0.5rem;
    }

    /* 모바일에서 좌우 여백 최소화 */
    .container {
        padding: 1rem 0.5rem;
        max-width: 100%;
    }

    /* 헤더 컨테이너 여백 조정 */
    .header-container {
        padding: 0 0.5rem;
    }

    /* 카드 컨테이너 여백 조정 */
    .card-container {
        gap: 1rem;
        padding: 0 0.5rem;
    }

    /* 카드 여백 조정 */
    .card {
        margin: 0;
    }

    .card-body {
        padding: 1rem;
    }

    /* 포스트 아이템 여백 조정 */
    .post-item,
    .post-detail {
        padding: 1rem;
        margin: 0 0.5rem 1rem 0.5rem;
    }

    /* 클래식 콘텐츠 여백 조정 */
    .classic-content {
        padding: 1rem;
        margin: 0 0.5rem;
    }

    /* 텍스트 섹션 여백 조정 */
    .text-section {
        margin: 10px 0;
        padding: 12px;
    }

    /* 검색 박스 여백 조정 */
    .search-box {
        width: 95%;
        margin: 0 auto;
    }

    /* 필터 컨테이너 여백 조정 */
    .filter-container {
        padding: 0 0.5rem;
    }

    /* 포스트 헤더 여백 조정 */
    .posts-header h1 {
        font-size: 1.8rem;
        padding: 0 0.5rem;
    }

    .post-item-header h2 {
        font-size: 1.3rem;
    }

    /* 콘텐츠 제목 여백 조정 */
    .content-title {
        padding: 0 0.5rem;
    }

    /* 권(卷) 그리드 여백 조정 */
    .volumes-grid {
        padding: 0 0.5rem;
        gap: 15px;
    }

    /* 클래식 리스트 여백 조정 */
    .classics-list .container {
        padding: 0 0.5rem;
    }

    /* 편집 컨테이너 여백 조정 */
    .edit-container {
        margin: 8px 0.5rem;
    }

    /* 삽입 버튼 컨테이너 여백 조정 */
    .insert-button-container {
        padding: 6px 0.5rem;
    }
}

/* 작은 모바일 화면 (480px 이하) */
@media (max-width: 480px) {
    .container {
        padding: 0.5rem 0.25rem;
    }

    .header-container {
        padding: 0 0.25rem;
    }

    .card-container {
        padding: 0 0.25rem;
        gap: 0.75rem;
    }

    .post-item,
    .post-detail {
        padding: 0.75rem;
        margin: 0 0.25rem 0.75rem 0.25rem;
    }

    .classic-content {
        padding: 0.75rem;
        margin: 0 0.25rem;
    }

    .text-section {
        padding: 10px;
    }

    .search-box {
        width: 98%;
    }

    .filter-container {
        padding: 0 0.25rem;
    }

    .posts-header h1 {
        padding: 0 0.25rem;
        font-size: 1.6rem;
    }

    .content-title {
        padding: 0 0.25rem;
    }

    .volumes-grid {
        padding: 0 0.25rem;
        gap: 10px;
    }

    .classics-list .container {
        padding: 0 0.25rem;
    }

    .edit-container {
        margin: 6px 0.25rem;
    }

    .insert-button-container {
        padding: 4px 0.25rem;
    }
}

/* 계층 구조 컨트롤 스타일 */
.hierarchy-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.hierarchy-action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.hierarchy-action-buttons button {
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
}

.hierarchy-action-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.hierarchy-plus-btn {
    background-color: #4a90e2;
    color: white;
}

.hierarchy-plus-btn:hover {
    background-color: #3a80d2;
}

.hierarchy-minus-btn {
    background-color: #e4a545;
    color: white;
}

.hierarchy-minus-btn:hover {
    background-color: #d49435;
}

.hierarchy-plus-btn i,
.hierarchy-minus-btn i,
.save-btn i {
    margin-right: 6px;
    font-size: 0.82em;
}

/* 저장 버튼 */
.save-btn {
    background-color: #4CAF50 !important;
    color: white !important;
    padding: 8px 15px;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.2s;
}

.save-btn:hover {
    background-color: #45a049 !important;
}

.edit-mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.edit-mode-switch input {
    display: none;
}

.edit-mode-switch-track {
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: #d8e0ec;
    border: 1px solid #c2cfdf;
    position: relative;
    transition: all 0.2s ease;
}

.edit-mode-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.edit-mode-switch input:checked + .edit-mode-switch-track {
    background: #3f80d2;
    border-color: #326cb2;
}

.edit-mode-switch input:checked + .edit-mode-switch-track .edit-mode-switch-thumb {
    transform: translateX(18px);
}

.edit-mode-switch-text {
    font-size: 0.84rem;
    font-weight: 700;
    color: #4a5f7b;
}

/* 상단 고정 콘텐츠 제목 */
.content-title.sticky {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px 20px;
    background-color: white;
    border-bottom: 2px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 100;
    transition: all 0.3s ease;
}

.content-title.sticky h2 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* 스크롤 중에 상단 고정 시 약간 작아지는 효과 */
.content-title.sticky.scrolled {
    padding: 10px 20px;
}

.content-title.sticky.scrolled h2 {
    font-size: 1.6rem;
}

/* 반응형 헤더 스타일 */
@media (max-width: 992px) {
    .header-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
    }

    .logo-section {
        text-align: center;
        justify-self: center;
    }

    .logo-section h1 {
        font-size: 2rem;
    }

    .logo-section p {
        font-size: 1rem;
    }

    .nav-links {
        justify-self: center;
        padding: 0.6rem 1rem;
    }

    .nav-links a {
        font-size: 1rem;
        padding: 0.4rem 1rem;
    }

    .user-menu {
        justify-self: center;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }

    .login-form {
        width: 100%;
    }

    .user-info {
        width: 100%;
        flex-direction: column;
        gap: 1rem;
    }

    .user-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .post-btn {
        margin: 10px 0;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    header {
        padding: 1rem 0;
    }

    .header-container {
        padding: 0.5rem;
    }

    .logo-section h1 {
        font-size: 1.8rem;
    }

    .nav-links {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .nav-links a {
        text-align: center;
        padding: 0.5rem;
    }

    .user-menu {
        padding: 10px;
    }

    .user-actions {
        flex-direction: column;
        width: 100%;
    }

    .user-actions button,
    .user-actions a {
        width: 100%;
        text-align: center;
    }

    .post-btn {
        margin: 8px 0;
        height: 40px;
        font-size: 0.95rem;
    }
}

.search-highlight {
    background-color: rgba(255, 235, 59, 0.4);
    padding: 2px 0;
    border-radius: 2px;
    transition: background-color 0.2s ease;
}

.search-highlight:hover {
    background-color: rgba(255, 235, 59, 0.6);
}

/* 권(卷) 선택 페이지 스타일 */
.volumes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.volume-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
}

.volume-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.volume-number {
    font-size: 1rem;
    font-weight: bold;
    color: #2c3e50;
}

.volume-card h3 {
    font-size: 0.8rem;
    color: #34495e;
    margin: 0;
}

@media (max-width: 768px) {
    .volumes-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .volume-card {
        padding: 15px;
    }

    .volume-number {
        font-size: 1.5rem;
    }

    .volume-card h3 {
        font-size: 1rem;
    }
}

/* ===== 고전DB 인라인 편집 스타일 ===== */

/* 편집 가능한 텍스트 스타일 */
.original-text[ondblclick],
.translation-text[ondblclick] {
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 2px 0;
}

.original-text[ondblclick]:hover,
.translation-text[ondblclick]:hover {
    background-color: rgba(74, 109, 167, 0.1);
}

.original-text[ondblclick]:active,
.translation-text[ondblclick]:active {
    background-color: rgba(74, 109, 167, 0.2);
}

/* 편집 컨테이너 스타일 */
.edit-container {
    background: #fff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: editSlideIn 0.3s ease;
}

@keyframes editSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 편집 텍스트 영역 스타일 */
.edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
    margin-bottom: 10px;
}

.edit-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 109, 167, 0.1);
}

/* 편집 컨트롤 버튼 스타일 */
.edit-controls {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.edit-save-btn,
.edit-cancel-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-save-btn {
    background-color: var(--accent-color);
    color: white;
}

.edit-save-btn:hover:not(:disabled) {
    background-color: #2d7a5f;
    transform: translateY(-1px);
}

.edit-save-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.edit-cancel-btn {
    background-color: #6c757d;
    color: white;
}

.edit-cancel-btn:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

/* 편집 메시지 스타일 */
.edit-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: messageSlideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.edit-message-success {
    background-color: var(--accent-color);
}

.edit-message-error {
    background-color: #dc3545;
}

.edit-message-info {
    background-color: var(--primary-color);
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .edit-container {
        padding: 12px;
        margin: 8px 0;
    }

    .edit-textarea {
        min-height: 60px;
        padding: 10px;
        font-size: 16px;
        /* 모바일에서 자동 확대 방지 */
    }

    .edit-controls {
        flex-direction: column;
        gap: 8px;
    }

    .edit-save-btn,
    .edit-cancel-btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }

    .edit-message {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

/* ===== 새로운 텍스트 카드 삽입 버튼 스타일 ===== */

.insert-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0;
    margin: 4px 0;
}

.insert-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px dashed #ccc;
    background-color: transparent;
    color: #666;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.insert-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background-color: rgba(58, 150, 121, 0.1);
    transform: scale(1.1);
}

.insert-btn:active {
    transform: scale(0.95);
}

.insert-btn span {
    line-height: 1;
    margin-top: -2px;
}

/* 삽입 버튼 호버 시 툴팁 */
.insert-btn::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    margin-bottom: 5px;
}

.insert-btn:hover::before {
    opacity: 1;
    visibility: visible;
}

/* 모바일에서 삽입 버튼 스타일 조정 */
@media (max-width: 768px) {
    .insert-button-container {
        padding: 6px 0;
        margin: 2px 0;
    }

    .insert-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .insert-btn::before {
        display: none;
        /* 모바일에서는 툴팁 숨김 */
    }
}

/* ===== 새 텍스트 카드 삽입 폼 스타일 ===== */
.insert-form-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.insert-form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.insert-form {
    background-color: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.insert-form h3 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
    font-size: 1.5em;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-color);
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.3s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(58, 150, 121, 0.1);
}

.form-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 25px;
}

.insert-save-btn,
.insert-cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.insert-save-btn {
    background-color: var(--accent-color);
    color: white;
}

.insert-save-btn:hover {
    background-color: #2d7a5f;
    transform: translateY(-1px);
}

.insert-save-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.insert-cancel-btn {
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.insert-cancel-btn:hover {
    background-color: #e5e5e5;
    color: #333;
}

/* 모바일에서 삽입 폼 스타일 조정 */
@media (max-width: 768px) {
    .insert-form-overlay {
        padding: 10px;
    }

    .insert-form {
        padding: 20px;
        max-height: 90vh;
    }

    .insert-form h3 {
        font-size: 1.3em;
    }

    .form-buttons {
        flex-direction: column;
    }

    .insert-save-btn,
    .insert-cancel-btn {
        width: 100%;
        padding: 12px;
    }
}

/* CSV 업로드 뷰어 스타일 */
.csv-upload-modal .modal-content {
    max-width: 900px;
}

.csv-preview-container {
    margin-top: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.csv-viewer-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 통계 카드 섹션 */
.csv-stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.csv-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
    transition: var(--transition);
}

.csv-stat-card:hover {
    box-shadow: var(--box-shadow);
    transform: translateY(-2px);
}

.csv-stat-card.csv-stat-warning {
    border-color: #ffc107;
    background-color: #fffbf0;
}

.csv-stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.csv-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.csv-stat-card.csv-stat-warning .csv-stat-value {
    color: #f57c00;
}

/* 경고 섹션 */
.csv-warning-section {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--border-radius);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.csv-warning-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #856404;
}

.warning-badge {
    display: inline-block;
    padding: 4px 8px;
    background-color: #ffc107;
    color: #856404;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* 섹션 제목 */
.csv-section {
    margin-top: 8px;
}

.csv-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

/* 컬럼 매핑 테이블 */
.csv-mapping-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.csv-mapping-table thead {
    background-color: var(--primary-light);
}

.csv-mapping-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary-color);
}

.csv-mapping-table td {
    padding: 12px;
    border-bottom: 1px solid var(--card-border);
}

.csv-mapping-table tbody tr:hover {
    background-color: var(--hover-bg);
}

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

/* 매핑 배지 */
.mapping-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.mapping-badge.mapping-success {
    background-color: #d4edda;
    color: #155724;
}

.mapping-badge.mapping-missing {
    background-color: #f8d7da;
    color: #721c24;
}

.mapping-badge.mapping-inline {
    display: block;
    margin-top: 4px;
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.7rem;
}

/* 샘플 데이터 섹션 */
.csv-sample-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.csv-sample-size-select {
    padding: 6px 12px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.csv-sample-size-select:hover {
    border-color: var(--input-focus);
}

.csv-sample-size-select:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(53, 82, 133, 0.15);
}

.csv-sample-table-container {
    max-height: 400px;
    overflow: auto;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    background: var(--card-bg);
}

.csv-sample-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.csv-sample-table thead {
    position: sticky;
    top: 0;
    background-color: var(--primary-light);
    z-index: 10;
}

.csv-sample-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary-color);
    white-space: nowrap;
}

.csv-sample-table td {
    padding: 8px;
    border-bottom: 1px solid var(--card-border);
    word-break: break-word;
    max-width: 300px;
}

.csv-sample-table tbody tr:hover {
    background-color: var(--hover-bg);
}

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

.csv-cell-empty {
    background-color: #fff3cd;
    color: #856404;
    font-style: italic;
}

.csv-sample-table td em {
    color: #999;
    font-style: italic;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .csv-upload-modal .modal-content {
        max-width: 95%;
        padding: 16px;
    }

    .csv-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .csv-sample-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .csv-sample-size-select {
        width: 100%;
    }

    .csv-sample-table-container {
        max-height: 300px;
    }

    .csv-sample-table {
        font-size: 0.75rem;
    }

    .csv-sample-table th,
    .csv-sample-table td {
        padding: 6px 4px;
    }

    .csv-mapping-table {
        font-size: 0.85rem;
    }

    .csv-mapping-table th,
    .csv-mapping-table td {
        padding: 8px;
    }
}
