/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f8fafc;
    color: #334155;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.logo-svg {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* 导航栏 */
header {
    background-color: #ffffff;
    padding: 10px 20px;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-container h1 {
    font-size: 20px;
    color: #1e3a8a;
    font-weight: 600;
}

/* 主体布局 */
.main-container {
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
    min-height: 0;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    min-width: 260px;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary:hover {
    background-color: #2563eb;
}
.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.note-item {
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.note-item:hover, .note-item.active {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.note-item-title {
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 编辑器区域 */
.editor-area {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    padding: 30px;
    min-width: 0;
}

.input-title {
    border: none;
    outline: none;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1e293b;
    width: 100%;
}

.textarea-content {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 16px;
    line-height: 1.6;
    color: #334155;
}

.editor-footer {
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.editor-footer button {
    float: none !important;
}

.status-text {
    font-size: 12px;
    color: #94a3b8;
    flex: 1 1 auto;
    min-width: 120px;
}

@media screen and (max-width: 820px) {
    header {
        padding: 12px 16px;
    }

    .header-container {
        flex-direction: column;
        align-items: stretch;
    }

    .user-auth-zone {
        justify-content: space-between;
        width: 100%;
    }

    .main-container {
        flex-direction: column;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding: 16px;
    }

    .editor-area {
        padding: 20px;
    }

    .input-title {
        font-size: 20px;
    }

    .textarea-content {
        font-size: 15px;
    }

    .editor-footer {
        justify-content: flex-start;
    }

    .modal-content {
        padding: 24px;
    }
}

@media screen and (max-width: 520px) {
    header {
        padding: 12px 12px;
    }

    .logo-container {
        gap: 10px;
    }

    .logo-container h1 {
        font-size: 18px;
    }

    .user-auth-zone {
        gap: 10px;
    }

    .sidebar {
        padding: 14px 12px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }

    .modal-content {
        padding: 20px;
    }
}

/* 顶部导航增强 */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.user-auth-zone {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.user-email {
    font-size: 14px;
    color: #64748b;
}
.btn-secondary {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.btn-secondary:hover {
    background-color: #e2e8f0;
}
.btn-text {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}
.hidden {
    display: none !important;
}

.modal.hidden {
    display: none !important;
}
.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: min(90vw, 360px);
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.auth-mode-buttons {
    display: flex;
    gap: 10px;
}
.auth-mode-buttons button {
    flex: 1;
}
.auth-error {
    color: #dc2626;
    font-size: 13px;
    min-height: 18px;
}
.modal-content h2 {
    font-size: 20px;
    color: #1e293b;
}
.modal-content input {
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
}
.modal-content input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

/* Title confirm modal overrides */
#title-confirm-modal .modal-content {
    width: min(90vw, 420px);
}
#generated-title-input {
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
}
#generated-title-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}
.placeholder-text {
    text-align: center;
    color: #94a3b8;
    margin-top: 40px;
    font-size: 14px;
}

.noscript-warning {
    padding: 18px 16px;
    text-align: center;
    background: #fef2f2;
    color: #b91c1c;
    border-bottom: 1px solid #fca5a5;
    font-size: 14px;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.btn-danger:hover {
    background-color: #dc2626;
}
.btn-danger:disabled {
    background-color: #f1f5f9;
    color: #cbd5e1;
    cursor: not-allowed;
}
