/* ========== 全局基础 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    background: #f5f6f8;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 密码验证遮罩层 ========== */
#password-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#password-overlay:not(.hide) {
    display: flex;
}

.overlay-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.overlay-dialog {
    position: relative;
    z-index: 1;
    width: 400px;
    max-width: 90vw;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 40px 36px 36px;
    animation: dialogIn 0.35s ease-out;
}

@keyframes dialogIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog-header {
    text-align: center;
    margin-bottom: 28px;
}

.dialog-header svg {
    display: block;
    margin: 0 auto 12px;
}

.dialog-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.dialog-header p {
    font-size: 14px;
    color: #999;
}

.dialog-body {
    text-align: center;
}

.password-input {
    width: 100%;
    height: 48px;
    border: 2px solid #e4e7ed;
    border-radius: 10px;
    padding: 0 16px;
    font-size: 16px;
    color: #333;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
    letter-spacing: 2px;
}

.password-input:focus {
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.12);
}

.password-submit {
    width: 100%;
    height: 48px;
    margin-top: 18px;
    background: linear-gradient(135deg, #4a6cf7, #6c8cff);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 4px;
    cursor: pointer;
    transition: opacity 0.25s, transform 0.15s;
}

.password-submit:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.password-submit:active {
    transform: translateY(0);
}

.password-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-msg {
    display: none;
    color: #e74c3c;
    font-size: 14px;
    margin-top: 14px;
}

/* ========== 新增表单（页面内） ========== */
.add-form-section {
    display: none;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 24px 20px;
}

.add-form-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px 28px;
    border: 1px solid #eef0f5;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.add-form-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f5;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.required {
    color: #e74c3c;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-actions .form-submit-btn {
    width: auto;
    min-width: 120px;
    padding: 0 28px;
}

.form-input {
    width: 100%;
    height: 44px;
    border: 2px solid #e4e7ed;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 14px;
    color: #333;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.form-input:focus {
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.12);
}

.form-textarea {
    width: 100%;
    border: 2px solid #e4e7ed;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    color: #333;
    outline: none;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.form-textarea:focus {
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.12);
}

.form-error-msg {
    display: none;
    color: #e74c3c;
    font-size: 13px;
    margin-bottom: 14px;
    text-align: center;
}

.form-submit-btn {
    width: 100%;
    height: 46px;
    background: linear-gradient(135deg, #4a6cf7, #6c8cff);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: opacity 0.25s, transform 0.15s;
}

.form-submit-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.form-submit-btn:active {
    transform: translateY(0);
}

.form-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== 主内容区 ========== */
#main-content {
    display: none;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* 顶部工具栏 */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
}

.add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #4a6cf7, #6c8cff);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
}

.add-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.add-btn:active {
    transform: translateY(0);
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #fff;
    color: #666;
    border: 1px solid #e0e3e9;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s;
}

.logout-btn:hover {
    color: #e74c3c;
    border-color: #f5c6cb;
    background: #fff5f5;
}

/* 搜索区 — 搜索引擎居中风格 */
.search-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px 50px;
    transition: padding 0.4s ease;
}

.search-area.has-results {
    padding: 32px 24px 28px;
}

.site-title {
    font-size: 42px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 36px;
    letter-spacing: 2px;
}

.has-results .site-title {
    font-size: 28px;
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 620px;
    background: #fff;
    border: 2px solid #e0e3e9;
    border-radius: 30px;
    overflow: hidden;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.search-box:focus-within {
    border-color: #4a6cf7;
    box-shadow: 0 2px 18px rgba(74, 108, 247, 0.12);
}

.search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 18px;
}

.search-icon {
    flex-shrink: 0;
    margin-right: 10px;
}

.search-input {
    flex: 1;
    height: 52px;
    border: none;
    outline: none;
    font-size: 16px;
    color: #333;
    background: transparent;
}

.search-input::placeholder {
    color: #bfbfbf;
}

.search-btn {
    flex-shrink: 0;
    height: 52px;
    padding: 0 32px;
    background: linear-gradient(135deg, #4a6cf7, #6c8cff);
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: opacity 0.25s, background 0.25s;
}

.search-btn:hover {
    opacity: 0.92;
}

.search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== 搜索结果区域 ========== */
.results-area {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 24px;
}

.results-container {
    padding-bottom: 40px;
}

.result-meta {
    font-size: 13px;
    color: #999;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.result-meta strong {
    color: #4a6cf7;
}

.result-empty {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
    font-size: 15px;
}

/* 结果卡片 */
.result-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 14px;
    border: 1px solid #eef0f5;
    transition: box-shadow 0.25s, border-color 0.25s;
}

.result-card:hover {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    border-color: #dde1eb;
}

.card-body {
    /* card content */
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 10px;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 13px;
    color: #888;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.meta-label {
    color: #bbb;
    font-size: 12px;
}

.status-normal {
    color: #27ae60;
}

.status-other {
    color: #e74c3c;
}

.card-remark {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #eef0f5;
    font-size: 13px;
    color: #777;
    line-height: 1.7;
    word-break: break-all;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .site-title {
        font-size: 28px;
        margin-bottom: 24px;
    }

    .has-results .site-title {
        font-size: 22px;
    }

    .search-area {
        padding: 50px 16px 30px;
    }

    .search-box {
        flex-direction: column;
        border-radius: 16px;
    }

    .search-input-wrap {
        width: 100%;
        padding: 8px 16px;
    }

    .search-input {
        height: 44px;
    }

    .search-btn {
        width: calc(100% - 16px);
        height: 44px;
        border-radius: 10px;
        margin: 0 8px 8px;
    }

    .result-card {
        padding: 16px;
    }

    .card-meta {
        flex-direction: column;
        gap: 4px;
    }

    .top-bar {
        padding: 12px 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .add-form-card {
        padding: 16px;
    }

    .form-actions .form-submit-btn {
        width: 100%;
    }
}
