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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100vh;
}

#app {
    display: flex;
    height: 100vh;
}

#sidebar {
    width: 200px;
    background: #f5f5f5;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #ddd;
}

.sidebar-header h2 {
    font-size: 14px;
    color: #666;
}

#file-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

#file-list li {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

#file-list li:hover {
    background: #e8e8e8;
}

#file-list li.active {
    background: #e3f2fd;
    color: #1976d2;
}

#file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.del-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
    opacity: 0;
}

.del-btn:hover {
    color: #d32f2f;
}

.folder-input {
    width: 100%;
    padding: 8px;
    margin: 4px 0;
    border: 1px solid #1976d2;
    border-radius: 4px;
    font-size: 13px;
}

#file-list li.folder {
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
}

#file-list li.folder {
    display: flex;
    align-items: center;
}

#file-list li.folder .folder-icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

#file-list li.folder .folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 8px;
}

ul.folder-files {
    padding-left: 24px;
    list-style: none;
}

ul.folder-files li {
    padding: 6px 16px;
}

#file-list li[draggable="true"] {
    cursor: move;
}

#file-list li.drag-over {
    background: #e3f2fd;
}

.folder-drop-zone {
    background: #fff3e0;
    border: 2px dashed #ff9800;
}

#file-list li .fa {
    font-size: 14px;
    color: #666;
    flex-shrink: 0;
}

.file-name {
    display: flex;
    align-items: center;
    overflow: hidden;
    flex: 1;
}

.file-name .fa {
    width: 40px;
    flex-shrink: 0;
}

.file-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#file-list li.active .file-name-text {
    color: #1976d2;
    font-weight: 500;
}

.del-btn {
    padding: 0 4px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    opacity: 0;
}

#file-list li:hover .del-btn {
    opacity: 1;
}

.del-btn:hover {
    color: #d32f2f;
}

#main {
    flex: 1;
    display: flex;
}

#editor-panel,
#pdf-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#editor-panel {
    border-right: 1px solid #ddd;
}

.panel-header {
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #666;
}

#editor {
    width: 100%;
    height: 100%;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-y: auto;
    flex: 1;
    background: #fff;
    outline: none;
    border: none;
    resize: none;
}

#editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#editor-container .cm-editor {
    height: 100%;
}

#pdf-container {
    flex: 1;
    background: #525252;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
}

#pdf-viewer {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

#recompile-btn {
    padding: 6px 12px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

#recompile-btn:hover {
    background: #1565c0;
}

#recompile-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#status {
    font-size: 12px;
    color: #888;
}

#status.compiling {
    color: #f57c00;
}

#status.error {
    color: #d32f2f;
}

#status.ready {
    color: #388e3c;
}

.hidden {
    display: none !important;
}

#login-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-box h1 {
    margin-bottom: 8px;
    color: #333;
}

.login-box p {
    margin-bottom: 24px;
    color: #666;
}

#access-code {
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 200px;
    text-align: center;
    margin-bottom: 16px;
}

#login-btn {
    padding: 12px 24px;
    font-size: 14px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 200px;
}

#login-btn:hover {
    background: #1565c0;
}

#login-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.error {
    color: #d32f2f;
    font-size: 14px;
    margin-top: 16px;
}

.small-btn {
    padding: 4px 8px;
    font-size: 11px;
    background: #666;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.small-btn:hover {
    background: #444;
}

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

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 320px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 16px;
    margin: 0;
}

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

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.info-row label {
    color: #666;
}

.danger-btn {
    padding: 10px;
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.danger-btn:hover {
    background: #b71c1c;
}

.info {
    font-size: 12px;
    color: #666;
    text-align: center;
}
