:root {
    --primary: #00f2ff;
    --bg-dark: #0a0a12;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    background-color: var(--bg-dark);
    color: white;
    font-family: 'Inter', 'Pretendard', sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 로그인 오버레이 */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a2e 0%, #05050a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.login-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 24px;
    width: 380px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

h2 {
    font-size: 24px;
    margin-bottom: 30px;
    letter-spacing: -0.5px;
    background: linear-gradient(45deg, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
    margin-left: 4px;
}

input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    outline: none;
    transition: 0.3s;
}

input:focus {
    border-color: var(--primary);
    background: rgba(0, 242, 255, 0.05);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
}

button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(45deg, #00d2ff, #3a7bd5);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 210, 255, 0.3);
}

button:active {
    transform: translateY(0);
}

/* 메인 대시보드 스타일 */
#main-content {
    display: none;
    width: 100%;
    height: 100vh;
    padding: 30px;
    flex-direction: column;
    animation: fadeIn 0.8s ease;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.project-info .label {
    font-size: 10px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 2px;
}

.project-info h1 {
    font-size: 28px;
    font-weight: 900;
    margin-top: 4px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff4d4d;
    padding: 6px 12px;
    border-radius: 8px;
    width: auto;
    font-size: 11px;
    margin: 0;
}

.btn-logout:hover {
    background: rgba(255, 77, 77, 0.1);
    box-shadow: none;
}

.dashboard {
    flex: 1;
    display: grid;
    grid-template-columns: 300px 1.1fr 1.9fr; /* 목차 패널 대폭 확장 */
    gap: 20px;
    height: calc(100vh - 150px);
}

.header-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px !important;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
    position: relative;
}

.panel-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--glass-border);
    z-index: 10;
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
}

.btn-add-mini {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 16px;
    border-radius: 6px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ref-list, .toc-list {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding-top: 50px;
    color: rgba(255, 255, 255, 0.2);
    font-size: 13px;
    line-height: 1.6;
}

/* 드래그 앤 드롭 오버레이 */
.drop-zone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 242, 255, 0.2);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    pointer-events: none;
    border: 2px dashed var(--primary);
    border-radius: 20px;
}

.ref-panel.drag-over .drop-zone-overlay {
    display: flex;
}

.toc-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.control-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    white-space: nowrap;
}

.select-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
}

.select-mini option {
    background: #1a1a2e;
    color: white;
}

.toc-editor-wrap {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

#toc-editor {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.8;
    resize: none;
    outline: none;
    font-family: 'Inter', sans-serif;
}

#toc-editor:focus {
    border-color: rgba(0, 242, 255, 0.3);
    background: rgba(0, 242, 255, 0.02);
}

.btn-execute-mini {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    width: auto;
}

.btn-execute-mini:hover {
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
    transform: scale(1.05);
}

.btn-clear-mini {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    border: 1px solid rgba(255, 77, 77, 0.2);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    width: auto;
}

.btn-clear-mini:hover {
    background: rgba(255, 77, 77, 0.2);
    border-color: #ff4d4d;
    transform: scale(1.05);
}

/* 파일 리스트 항목 스타일 */
.ref-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.3s;
    animation: fadeIn 0.3s ease;
}

.ref-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 242, 255, 0.2);
}

.ref-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    overflow: hidden;
}

.ref-info span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-del-mini {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255, 77, 77, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    cursor: pointer;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 0;
}

.btn-del-mini:hover {
    background: #ff4d4d;
    color: white;
    box-shadow: 0 0 15px rgba(255, 77, 77, 0.5);
    transform: rotate(90deg) scale(1.1);
}

/* Output Screen */
.output-screen {
    flex: 1;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    margin: 15px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.9);
}

.terminal-placeholder {
    color: var(--primary);
    font-family: 'Consolas', monospace;
    opacity: 0.6;
}

/* Footer removed - Controls moved to header */

.page-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-control .control-label {
    font-size: 11px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.5);
}

.page-control input {
    width: 45px; /* 너비 확장 */
    height: 28px; /* 높이 확장 */
    background: rgba(255, 255, 255, 0.15); /* 회색 배경 농도 조절 */
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    color: #ffffff !important; /* 확실한 흰색 */
    font-weight: 800;
    font-size: 14px;
    text-align: center;
    outline: none;
    padding: 0; /* 패딩 제거로 글자 잘림 방지 */
    line-height: 28px; /* 높이와 일치시켜 세로 중앙 정렬 */
    display: inline-block;
}

/* 스핀 버튼 제거 */
.page-control input::-webkit-outer-spin-button,
.page-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.btn-primary-glow {
    background: var(--primary) !important;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
    color: #000 !important;
}

.btn-primary-glow:hover {
    box-shadow: 0 0 25px rgba(0, 242, 255, 0.6);
    transform: scale(1.05);
}

/* Legacy buttons removed */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.welcome-text {
    font-size: 80px;
    font-weight: 900;
    letter-spacing: -2px;
    text-shadow: 0 0 30px rgba(0, 242, 255, 0.5);
    background: linear-gradient(to right, #fff, var(--primary), #fff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}
