:root {
    --sidebar-width: 280px;
    --header-height: 60px;
    --editor-padding: 20px;
}

/* 레이아웃 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.main {
    margin-top: 1rem;
}

/* 노트 앱 */
.notes-app {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    background-color: var(--surface-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* 사이드바 */
.notes-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: var(--surface-secondary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.notes-search {
    padding: 12px 16px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.notes-search input {
    width: 100%;
    padding: 8px 8px 8px 32px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.notes-search i {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.notes-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 8px;
}

.note-item {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.note-item:hover {
    background-color: var(--surface-hover);
}

.note-item.active {
    background-color: var(--primary-color-light);
    border-left: 3px solid var(--primary-color);
}

.note-item-title {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-date {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.notes-status {
    padding: 12px 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sync-status.syncing i {
    animation: spin 1.5s linear infinite;
}

.sync-status.error {
    color: var(--error-color);
}

/* 에디터 */
.notes-editor {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-header {
    height: var(--header-height);
    padding: 0 var(--editor-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.note-title-input {
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    width: 100%;
    margin-right: 1rem;
}

.editor-actions {
    display: flex;
    gap: 8px;
}

.editor-container {
    flex-grow: 1;
    display: flex;
    position: relative;
    height: 100%;
    overflow: hidden;
}

#noteContent,
.preview-area {
    width: 100%;
    height: 100%;
    padding: var(--editor-padding);
    overflow-y: auto;
    box-sizing: border-box;
}

#noteContent {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    border: none;
    outline: none;
    resize: none;
    background-color: transparent;
    color: var(--text-primary);
}

.preview-area {
    display: none;
    background-color: var(--surface-primary);
    overflow-y: auto !important;
    max-height: 100%;
}

.editor-footer {
    height: 40px;
    padding: 0 var(--editor-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.markdown-hint {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 버튼 스타일 */
.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-button:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.icon-button.danger:hover {
    background-color: var(--error-bg);
    color: var(--error-color);
}

.button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

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

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

.secondary-button {
    background-color: var(--surface-secondary);
    color: var(--text-primary);
}

.secondary-button:hover {
    background-color: var(--surface-hover);
}

.danger-button {
    background-color: var(--error-color);
    color: white;
}

.danger-button:hover {
    background-color: var(--error-color-dark);
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--surface-primary);
    border-radius: 8px;
    padding: 24px;
    width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

/* 토스트 알림 */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background-color: var(--error-bg);
    color: var(--error-color);
    border-radius: 4px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast.success-toast {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.toast.active {
    display: block;
    opacity: 1;
    animation: fadeInOut 3s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; display: none; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 마크다운 스타일 */
.markdown-body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 { font-size: 2em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.5em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.875em; }
.markdown-body h6 { font-size: 0.85em; color: var(--text-secondary); }

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote {
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 2em;
}

.markdown-body blockquote {
    padding: 0 1em;
    color: var(--text-secondary);
    border-left: 0.25em solid var(--border-color);
}

.markdown-body pre {
    background-color: var(--code-bg);
    border-radius: 4px;
    padding: 16px;
    overflow: auto;
    font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.markdown-body code {
    background-color: var(--code-bg);
    border-radius: 3px;
    font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
}

.markdown-body a {
    color: var(--primary-color);
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: var(--border-color);
    border: 0;
}

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
}

.markdown-body table th,
.markdown-body table td {
    padding: 6px 13px;
    border: 1px solid var(--border-color);
}

.markdown-body table tr {
    background-color: var(--surface-primary);
    border-top: 1px solid var(--border-color);
}

.markdown-body table tr:nth-child(2n) {
    background-color: var(--surface-secondary);
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .notes-app {
        flex-direction: column;
        height: calc(100vh - 150px);
    }
    
    .notes-sidebar {
        width: 100%;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .notes-editor {
        height: 60%;
    }
    
    .modal-content {
        width: 90%;
        max-width: 350px;
    }
}

/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* 인증 폼 스타일 */
.auth-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 40px auto;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

button {
    width: 100%;
    padding: 10px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

.auth-form p {
    text-align: center;
    margin-top: 15px;
}

.auth-form a {
    color: #3498db;
    text-decoration: none;
}

.auth-form a:hover {
    text-decoration: underline;
}

/* 메모 앱 스타일 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

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

#logoutBtn {
    width: auto;
    padding: 8px 15px;
    background-color: #e74c3c;
}

#logoutBtn:hover {
    background-color: #c0392b;
}

.memo-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.memo-input {
    margin-bottom: 20px;
}

textarea {
    width: 100%;
    height: 100px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 10px;
}

textarea:focus {
    outline: none;
    border-color: #3498db;
}

.memo-list {
    display: grid;
    gap: 15px;
}

.memo-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    position: relative;
}

.memo-item .delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    width: auto;
    padding: 5px;
}

.memo-item .delete-btn:hover {
    color: #c0392b;
}

.memo-content {
    margin-top: 5px;
    white-space: pre-wrap;
} 