/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Playfair Display', 'Austin News Deck Web', serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
    overflow-x: hidden;
    font-weight: 300;
    letter-spacing: normal;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
}

/* Login Screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 80px 40px 60px 40px;
    text-align: center;
}

.app-title {
    font-family: 'Playfair Display', 'Austin News Deck Web', serif;
    font-size: 28px;
    font-weight: 500;
    letter-spacing: normal;
    margin-bottom: 0;
    color: #000;
    text-transform: lowercase;
    line-height: 1.1;
    position: relative;
    display: inline;
    cursor: pointer;
    transform: scaleY(1.3);
    transform-origin: center;
}

.app-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 48px;
    font-weight: 300;
    letter-spacing: 1px;
}

.login-form {
    text-align: left;
    margin-top: 60px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 300;
    color: #333;
    margin-bottom: 8px;
    letter-spacing: normal;
    text-transform: lowercase;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    height: 44px;
    padding: 0 0 8px 0;
    border: none;
    border-bottom: 1px solid #e1e1e1;
    border-radius: 0;
    font-size: 14px;
    font-weight: 300;
    letter-spacing: normal;
    background-color: transparent;
    transition: border-color 0.2s ease;
}

.form-group input[type="text"]::placeholder,
.form-group input[type="password"]::placeholder {
    color: #ccc;
}

.form-group input:focus {
    outline: none;
    border-bottom-color: #333;
}

.checkbox-group {
    margin-bottom: 32px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #666;
    font-weight: 300;
    letter-spacing: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
}

.login-btn {
    width: 100%;
    height: 40px;
    background-color: transparent;
    color: #000;
    border: 0.5px solid #000;
    border-radius: 0;
    font-family: 'Playfair Display', 'Austin News Deck Web', serif;
    font-size: 14px;
    font-weight: 300;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 24px;
}

.login-btn:hover {
    background-color: #000;
    color: #fff;
}

.login-btn:disabled {
    background-color: transparent;
    color: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}

.login-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.clear-cache-btn {
    padding: 6px 12px;
    background-color: transparent;
    color: #ff4444;
    border: 0.5px solid #ff4444;
    border-radius: 0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-cache-btn:hover {
    background-color: #ff4444;
    color: white;
}

.login-actions a {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    border-bottom: 1px solid #e1e1e1;
    transition: color 0.2s ease;
    margin-top: 16px;
}

.login-actions a:hover {
    color: #333;
}

/* About Modal Styles */
.about-section {
    margin-bottom: 24px;
}

.about-section h4 {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    border-bottom: 1px solid #e1e1e1;
    padding-bottom: 4px;
}

.about-section p {
    line-height: 1.6;
    color: #555;
    margin-bottom: 12px;
}

.journey-step {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: #666;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
}

.feature-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Main Application */
#main-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background-color: #fff;
    border-bottom: 1px solid #e1e1e1;
}

.app-logo {
    font-size: 18px;
    font-weight: 300;
    letter-spacing: -0.3px;
    color: #000;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 13px;
    color: #666;
}

.logout-btn {
    padding: 6px 12px;
    background-color: transparent;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    font-family: 'Playfair Display', 'Austin News Deck Web', serif;
    font-size: 13px;
    font-weight: 300;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background-color: #ffffff;
    color: #333;
}

/* Main Layout */
.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 200px;
    max-width: 600px;
    background-color: #fff;
    border-right: 1px solid #e1e1e1;
    overflow-y: auto;
    position: relative;
}

/* Resize Handle */
.resize-handle {
    width: 4px;
    background-color: transparent;
    cursor: col-resize;
    position: relative;
    z-index: 10;
    transition: background-color 0.2s ease;
}

.resize-handle:hover {
    background-color: #007acc;
}

.resize-handle:active {
    background-color: #005a9e;
}

.resize-handle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    right: -2px;
    bottom: 0;
    background-color: transparent;
}

/* Resizing 상태 */
.resizing {
    user-select: none;
    cursor: col-resize;
}

.resizing * {
    pointer-events: none;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e1e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 14px;
    font-weight: 300;
    letter-spacing: normal;
    text-transform: lowercase;
    color: #333;
}

.sidebar-actions {
    display: flex;
    gap: 4px;
}

.sidebar-btn {
    width: 24px;
    height: 24px;
    border: none;
    background-color: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-btn:hover {
    background-color: #ffffff;
}

.file-tree {
    padding: 12px 0;
    transition: max-height 0.3s ease;
}

.file-tree.collapsed {
    max-height: 0;
    overflow: hidden;
}

.file-item {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 300;
    letter-spacing: normal;
    color: #666;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-item:hover {
    background-color: #ffffff;
    color: #333;
}

.file-item.active {
    background-color: #000;
    color: #fff;
}

.file-item.folder {
    font-weight: 300;
}

.folder-toggle {
    display: inline-block;
    width: 16px;
    height: 16px;
    text-align: center;
    cursor: pointer;
    font-size: 10px;
    color: #666;
    margin-right: 4px;
    transition: color 0.2s ease;
}

.folder-toggle:hover {
    color: #333;
}

.file-item.file::before {
    content: '📄';
    font-size: 12px;
}

.file-item.nested {
    padding-left: 40px;
}

.file-item.nested-2 {
    padding-left: 60px;
}

.file-date {
    font-size: 12px;
    color: #999;
    font-weight: 300;
    letter-spacing: normal;
    margin-left: auto;
}

.file-actions {
    display: none;
    gap: 4px;
    margin-left: 8px;
}

.file-item:hover .file-actions {
    display: flex;
}

.file-action-btn {
    width: 20px;
    height: 20px;
    border: none;
    background-color: transparent;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.file-item.active .file-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Editor Section */
.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-right: 1px solid #e1e1e1;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e1e1e1;
}

.editor-title {
    flex: 1;
    margin-right: 16px;
}

.file-title-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    font-weight: 300;
    letter-spacing: normal;
    color: #333;
    width: 100%;
    padding: 4px 0;
}

.file-title-input::placeholder {
    color: #999;
    font-weight: 400;
}

.file-title-input:disabled {
    color: #666;
    background-color: #f5f5f5;
}

.editor-stats {
    font-size: 13px;
    color: #666;
    font-weight: 300;
    letter-spacing: normal;
}

.editor-stats.warning {
    color: #ff6b35;
}

.editor-stats.success {
    color: #4caf50;
}

.editor-container {
    flex: 1;
    padding: 0;
}

.editor-textarea {
    width: 100%;
    height: 100%;
    padding: 24px;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Playfair Display', 'Austin News Deck Web', serif;
    font-size: 14px;
    font-weight: 300;
    letter-spacing: normal;
    line-height: 1.7;
    color: #333;
    background-color: #fff;
}

.editor-textarea::placeholder {
    color: #999;
    line-height: 1.7;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid #e1e1e1;
    background-color: #fafafa;
}

.save-btn {
    padding: 8px 20px;
    background-color: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.save-btn:hover:not(:disabled) {
    background-color: #333;
}

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

.writing-time {
    font-size: 12px;
    color: #999;
}

/* Preview Section */
.preview-section {
    width: 360px;
    background-color: #fff;
    overflow-y: auto;
}

.preview-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e1e1;
}

.preview-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.preview-content {
    padding: 24px;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
    transition: max-height 0.3s ease;
}

.preview-content.collapsed {
    max-height: 0;
    overflow: hidden;
}

.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
    margin: 24px 0 16px 0;
    font-weight: 600;
    color: #000;
}

.preview-content h1 { font-size: 24px; }
.preview-content h2 { font-size: 20px; }
.preview-content h3 { font-size: 18px; }

.preview-content p {
    margin-bottom: 16px;
}

.preview-content ul,
.preview-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.preview-content li {
    margin-bottom: 4px;
}

.preview-content blockquote {
    border-left: 3px solid #e1e1e1;
    padding-left: 16px;
    margin: 16px 0;
    color: #666;
    font-style: italic;
}

.preview-content code {
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
}

.preview-content pre {
    background-color: #f5f5f5;
    padding: 16px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 16px 0;
}

/* Heatmap Section - 웹 버전 */
.heatmap-section {
    background-color: #fff;
    border-top: 1px solid #e1e1e1;
    padding: 20px 24px;
}

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

.heatmap-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-decoration: underline;
}

.stats-toggle-btn {
    display: block;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.stats-toggle-btn:hover {
    background-color: #ffffff;
}

.heatmap-container {
    overflow-x: auto;
    display: none;
}

.heatmap-container.show {
    display: block;
}

.heatmap {
    display: flex;
    gap: 3px;
    min-width: 800px;
}

.heatmap-month {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-day {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    background-color: #ebedf0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.heatmap-day.morning {
    background-color: #4caf50; /* 10시까지 - 초록 */
}

.heatmap-day.afternoon {
    background-color: #ffc107; /* 14시까지 - 노랑 */
}

.heatmap-day.evening {
    background-color: #ff9800; /* 23:59까지 - 주황 */
}

.heatmap-day:hover {
    transform: scale(1.2);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    pointer-events: auto;
}

.modal-content {
    background-color: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    pointer-events: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e1e1e1;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 24px;
}

.modal-body ol {
    margin: 16px 0;
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.modal-note {
    margin-top: 16px;
    padding: 12px;
    background-color: #fff3cd;
    border-radius: 4px;
    font-size: 13px;
    color: #856404;
}

/* 수키피 확인 모달 */
.sukipi-modal {
    max-width: 350px;
    text-align: center;
}

.sukipi-modal h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: #333;
}

.sukipi-modal p {
    font-size: 16px;
    margin-bottom: 24px;
    color: #666;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 20px;
    border: 0.5px solid #000;
    border-radius: 0;
    font-family: 'Playfair Display', 'Austin News Deck Web', serif;
    font-size: 14px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    background-color: transparent;
    color: #000;
}

.modal-btn.primary {
    background-color: transparent;
    color: #000;
    border: 0.5px solid #000;
}

.modal-btn.primary:hover {
    background-color: #000;
    color: #fff;
}

.modal-btn.secondary {
    background-color: transparent;
    color: #666;
    border: 0.5px solid #666;
}

.modal-btn.secondary:hover {
    background-color: #666;
    color: #fff;
}

.modal-btn.danger {
    background-color: transparent;
    color: #ff4444;
    border: 0.5px solid #ff4444;
}

.modal-btn.danger:hover {
    background-color: #ff4444;
    color: #fff;
}

/* 파일 생성 모달 */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e1e1e1;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

/* Mobile Toggle Icons */
.mobile-toggle-icon {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.mobile-toggle-icon.collapsed {
    transform: rotate(-90deg);
}

/* Desktop에서 토글 아이콘 숨김 */
@media (min-width: 769px) {
    .mobile-toggle-icon {
        display: none;
    }
}

/* Mobile Responsive - 웹 버전과 완전히 다른 모바일 레이아웃 */
@media (max-width: 768px) {
    .login-container {
        padding: 40px 24px;
        max-width: 100%;
    }
    
    .app-title {
        font-size: 24px;
        margin-bottom: 0;
    }
    
    .app-subtitle {
        font-size: 13px;
        margin-bottom: 24px;
    }
    
    .form-group label {
        font-size: 12px;
    }
    
    .form-group input[type="text"],
    .form-group input[type="password"] {
        font-size: 13px;
    }
    
    .checkbox-label {
        font-size: 12px;
    }
    
    .login-btn {
        font-size: 13px;
    }
    
    .clear-cache-btn {
        font-size: 11px;
    }
    
    .login-actions a {
        font-size: 12px;
    }
    
    .app-header {
        padding: 12px 16px;
    }
    
    /* 모바일 메인 컨테이너 - 세로 스택 */
    .app-main {
        flex-direction: column;
        height: calc(100vh - 60px);
        overflow: hidden;
        position: relative;
    }
    
    /* 1. 파일 섹션 - 상단 토글 */
    .sidebar {
        width: 100% !important;
        border: none;
        min-width: unset;
        max-width: unset;
        order: 1;
        position: relative;
        flex-shrink: 0;
        margin: 0;
    }
    
    .sidebar-header {
        background-color: #ffffff;
        padding: 4px 8px;
        border-bottom: 1px solid #e1e1e1;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        transition: background-color 0.2s ease;
        margin: 0;
        min-height: 32px;
    }
    
    .sidebar-header:hover {
        background-color: #ffffff;
    }
    
    .sidebar-header h3 {
        font-size: 12px;
        font-weight: 500;
    }
    
    .file-tree {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background-color: #fff;
        margin: 0;
        padding: 0;
    }
    
    .file-tree.expanded {
        max-height: 200px;
        overflow-y: auto;
        border-bottom: 1px solid #e1e1e1;
        padding: 0;
        margin: 0;
    }
    
    .file-item {
        padding: 4px 8px;
        font-size: 11px;
        margin: 0;
        min-height: 26px;
    }
    
    .resize-handle {
        display: none;
    }
    
    /* 2. 작성하기 섹션 - 메인 영역 (항상 펼쳐져 있음) */
    .editor-section {
        flex: 1;
        border: none;
        display: flex;
        flex-direction: column;
        order: 2;
        background-color: #fff;
        min-height: 0;
        margin: 0;
        padding: 0;
    }
    
    .editor-header {
        padding: 6px 8px;
        border-bottom: 1px solid #e1e1e1;
        background-color: #fafafa;
        flex-shrink: 0;
    }
    
    .file-title-input {
        font-size: 13px;
        padding: 6px 0;
    }
    
    .editor-stats {
        font-size: 12px;
    }
    
    .editor-container {
        flex: 1;
        min-height: 0;
    }
    
    .editor-textarea {
        width: 100%;
        height: 100%;
        padding: 16px;
        font-size: 13px;
        line-height: 1.6;
        border: none;
        resize: none;
    }
    
    .editor-footer {
        padding: 6px 8px;
        border-top: 1px solid #e1e1e1;
        background-color: #fafafa;
        flex-shrink: 0;
    }
    
    .save-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    /* 3. 미리보기 섹션 - 작성하기 바로 밑에 붙어서 토글 */
    .preview-section {
        width: 100%;
        border: none;
        order: 3;
        border-top: 1px solid #e1e1e1;
        background-color: #fff;
        margin: 0;
        padding: 0;
    }
    
    .preview-header {
        background-color: #ffffff;
        padding: 4px 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        transition: background-color 0.2s ease;
        margin: 0;
        min-height: 32px;
    }
    
    .preview-header:hover {
        background-color: #ffffff;
    }
    
    .preview-header h3 {
        font-size: 12px;
        font-weight: 500;
    }
    
    .preview-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background-color: #fff;
        margin: 0;
        padding: 0;
        border: none;
        line-height: 0;
    }
    
    .preview-content.expanded {
        max-height: 250px;
        overflow-y: auto;
        padding: 8px;
        margin: 0;
        line-height: 1.6;
        font-size: 13px;
    }
    
    /* 4. 작성현황 섹션 - 미리보기 바로 밑에 붙어서 토글 */
    .heatmap-section {
        width: 100%;
        border: none;
        padding: 0;
        order: 4;
        background-color: #fff;
        margin: 0;
    }
    
    .heatmap-header {
        background-color: #ffffff;
        padding: 4px 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        transition: background-color 0.2s ease;
        margin: 0;
        min-height: 32px;
    }
    
    .heatmap-header:hover {
        background-color: #ffffff;
    }
    
    .heatmap-header h3 {
        font-size: 12px;
        font-weight: 500;
        color: #333;
        text-decoration: underline;
    }
    
    .heatmap-container {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background-color: #fff;
        margin: 0;
        padding: 0;
        border: none;
        line-height: 0;
    }
    
    .heatmap-container.expanded {
        max-height: 200px !important;
        min-height: 100px !important;
        overflow-y: auto;
        padding: 8px !important;
        margin: 0;
        line-height: 1.6 !important;
        background-color: #fff !important;
        border: 1px solid #e1e1e1;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* 모달 */
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
}

@media (max-width: 480px) {
    .header-right {
        gap: 8px;
    }
    
    .user-info {
        display: none;
    }
    
    .editor-textarea {
        padding: 16px;
    }
    
    .preview-content {
        padding: 16px;
    }
}
