/* 用户个人中心专属样式 */
/* 由 includes/header.php 自动加载，用户中心页面无需再写 inline <style> */

/* ===== 按钮样式覆盖 ===== */
/* style.css 的 .btn-primary 是白底蓝字，在用户中心浅色背景上看不清，这里覆盖为蓝底白字 */
.user-content .btn-primary,
.user-card .btn-primary {
    background: var(--primary, #5F9EFE);
    color: #fff;
    border: none;
}
.user-content .btn-primary:hover,
.user-card .btn-primary:hover {
    background: var(--primary-dark, #4a8deb);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(95,158,254,.3);
}

/* 确保按钮在用户中心有正确的间距 */
.user-content .btn,
.user-card .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 小型按钮在用户中心的样式 */
.user-content .btn-sm,
.user-card .btn-sm {
    padding: 5px 14px;
    font-size: 12px;
    border-radius: 8px;
}

/* ===== 布局 ===== */
.user-center-layout {
    display: flex;
    gap: 2rem;
    max-width: 1400px !important;
    width: 100%;
    margin: 2rem auto 0;
    padding: 0 24px 40px;
    align-items: flex-start;
    box-sizing: border-box;
}
.user-content { flex: 1 1 0%; min-width: 0; }

/* ===== 卡片基础 ===== */
.user-card {
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid var(--border, #e5e7eb);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* 卡片头部：标题和按钮在同一行，按钮靠右 */
.user-card > .card-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 12px;
}
.user-card > .card-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

/* ===== bookmarks.php ===== */
.bm-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.bm-table { width: 100%; border-collapse: collapse; }
.bm-table th { padding: 12px 14px; text-align: left; border-bottom: 2px solid var(--border, #e5e7eb); font-size: 13px; color: var(--text-light); }
.bm-table td { padding: 12px 14px; border-bottom: 1px solid var(--border, #e5e7eb); font-size: 14px; }
.bm-table tr:hover td { background: var(--hover, #f3f4f6); }
.bm-logo { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: var(--hover, #f3f4f6); flex-shrink: 0; }
.bm-name { font-weight: 500; display: flex; align-items: center; gap: 10px; }
.bm-url { color: var(--primary); font-size: 12px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-actions { display: flex; gap: 6px; }
.bm-empty { text-align: center; padding: 3rem; color: var(--text-light); }
.bm-empty-icon { font-size: 3rem; margin-bottom: 8px; }

.bm-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 9999; align-items: center; justify-content: center; }
.bm-modal.show { display: flex; }
.bm-modal-box { background: var(--card-bg); border-radius: 16px; padding: 28px; max-width: 480px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.bm-modal-box h3 { margin: 0 0 18px; font-size: 18px; }
.bm-modal-box input[type=text] { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; margin-bottom: 12px; background: var(--bg); color: var(--text); box-sizing: border-box; }
.bm-modal-box input[type=text]:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(95,158,254,.12); }
.bm-logo-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.bm-logo-row img { width: 44px; height: 44px; border-radius: 8px; object-fit: contain; border: 1px solid var(--border); }
.bm-logo-row input[type=file] { display: none; }
.bm-toggle-row { margin-bottom: 10px; }
.bm-toggle-row label { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.bm-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ===== points.php ===== */
.cards-row { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1.5rem; }
.cards-row .stat-card {
    flex: 1; min-width: 220px;
    background: var(--card-bg, #fff);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    border: 1px solid var(--border, #e5e7eb);
    text-align: center;
}
@media (max-width: 900px) { .cards-row .stat-card { min-width: 260px; } }

/* 通用卡片头部 - 使用 flex 布局让标题和按钮在同一行 */
.user-center-layout .card-header,
.user-content .card-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 12px;
}
.user-center-layout .card-header h3,
.user-content .card-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.points-value { font-size: 2.2rem; font-weight: bold; color: var(--primary, #5F9EFE); margin: 10px 0; }
.vip-badge { background: linear-gradient(135deg, #9b59b6, #8e44ad); color: white; padding: 4px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; display: inline-block; }
.user-center-layout .btn-group { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; justify-content: center; }

.records-section { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.records-section > div { flex: 1; min-width: 280px; }
.record-card {
    background: var(--card-bg, #fff);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    border: 1px solid var(--border, #e5e7eb);
    text-align: left;
}
.record-card .card-header { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border, #e5e7eb); }
.records-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.records-table th, .records-table td { padding: 9px 12px; border-bottom: 1px solid var(--border, #e5e7eb); text-align: left; }
.records-table th { background: rgba(0,0,0,.03); font-weight: 600; color: #6b7280; font-size: 12px; }
.load-more-btn { margin-top: 12px; text-align: center; }
.load-more-btn button {
    background: transparent; border: 1px solid var(--primary,#5F9EFE);
    color: var(--primary,#5F9EFE); padding: 5px 18px;
    border-radius: 20px; cursor: pointer; font-size: 12px;
}
.load-more-btn button:hover { background: rgba(95,158,254,.08); }
.empty-text { text-align: center; color: #9ca3af; font-size: 13px; padding: 18px 0; }

.recharge-card {
    background: var(--card-bg, #fff);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    border: 1px solid var(--border, #e5e7eb);
    text-align: center;
}
.recharge-card .card-header { margin-bottom: 12px; }
.recharge-card p { color: #9ca3af; font-size: 14px; }
.recharge-options { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 14px 0; }
.recharge-option {
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    min-width: 80px;
    transition: all .15s;
}
.recharge-option:hover { border-color: var(--primary); background: rgba(95,158,254,.04); }
.recharge-option.active { border-color: var(--primary); background: rgba(95,158,254,.08); }
.recharge-option .amount { font-size: 18px; font-weight: 700; color: var(--primary); }
.recharge-option .points-info { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ===== notes.php ===== */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.note-item { padding: 14px; border-radius: 10px; min-height: 100px; word-break: break-word; position: relative; font-size: 14px; line-height: 1.5; }
.note-item .pinned-badge { position: absolute; top: 6px; right: 8px; font-size: 12px; }
.note-time { font-size: 11px; color: rgba(0,0,0,.35); margin-top: 8px; }
.note-empty { text-align: center; padding: 3rem; color: var(--text-light); }

/* ===== color_favorites.php ===== */
.favorites-card {
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid var(--border, #e5e7eb);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.color-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 0.8rem;
    text-align: center;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: .1s;
}
.color-item:hover { transform: scale(1.02); border-color: var(--primary); }
.color-preview {
    width: 100%;
    height: 80px;
    border-radius: .6rem;
    margin-bottom: .5rem;
}
.color-hex { font-family: monospace; font-size: .8rem; }
.color-date { font-size: .7rem; color: var(--text-light); margin-top: .3rem; }
.empty-msg { text-align: center; padding: 2rem; color: var(--text-light); }

/* 颜色详情弹窗 */
.color-detail-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center; z-index: 10002;
}
.modal-inner {
    background: var(--card-bg); border-radius: 10px; padding: 1.5rem;
    max-width: 550px; width: 90%; max-height: 85vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; }
.modal-close { cursor: pointer; font-size: 1.5rem; line-height: 1; }
.color-preview-large {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-bottom: 1.2rem; padding-bottom: .8rem; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.preview-info { display: flex; align-items: center; gap: 1rem; }
.preview-circle { width: 60px; height: 60px; border-radius: .75rem; border: 1px solid var(--border); }
.delete-btn {
    background: rgba(231,76,60,.1); border: 1px solid rgba(231,76,60,.3);
    border-radius: 2rem; padding: .4rem 1rem; color: #e74c3c;
    cursor: pointer; font-size: .85rem; font-weight: 500; transition: .2s;
}
.delete-btn:hover { background: rgba(231,76,60,.2); border-color: #e74c3c; }
.code-section { margin-bottom: 1.2rem; }
.code-section h4 { font-size: .9rem; margin-bottom: .5rem; font-weight: 600; }
.color-code-item {
    background: var(--bg); padding: .5rem .8rem; border-radius: .6rem;
    margin-bottom: .5rem; display: flex; justify-content: space-between; align-items: center;
    font-family: monospace; font-size: .85rem; cursor: pointer; transition: .1s; border: 1px solid transparent;
}
.color-code-item:hover { border-color: var(--primary); background: rgba(59,130,246,.08); }
.copy-hint { font-size: .7rem; background: var(--primary); color: #fff; padding: .2rem .5rem; border-radius: 10px; opacity: .8; }
.scheme-block { margin-top: 1.2rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.scheme-row { display: flex; align-items: flex-start; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.scheme-group { flex: 1; min-width: 180px; }
.scheme-group-title { font-size: .85rem; font-weight: 500; margin-bottom: .5rem; color: var(--text-light); }
.scheme-colors { display: flex; flex-wrap: wrap; gap: .8rem; }
.scheme-color-item { display: flex; flex-direction: column; align-items: center; gap: .3rem; cursor: pointer; }
.scheme-color-circle { width: 48px; height: 48px; border-radius: .6rem; border: 1px solid var(--border); }
.scheme-color-code { font-size: .7rem; font-family: monospace; }
.divider { width: 1px; background: var(--border); align-self: stretch; margin: 0 .5rem; }
.toast-msg {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,.8); color: #fff; padding: 6px 12px; border-radius: 20px; font-size: 12px; z-index: 10003;
}

/* 全局确认模态框 */
.global-confirm-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 10004;
}
.confirm-modal-content {
    background: var(--card-bg); border-radius: 10px; padding: 1.5rem; max-width: 400px; width: 90%; text-align: center; border: 1px solid var(--border);
}
.confirm-modal-content p { margin-bottom: 1.2rem; }
.confirm-buttons { display: flex; gap: 1rem; justify-content: center; }
.confirm-buttons button { padding: .4rem 1.2rem; border-radius: 2rem; border: none; cursor: pointer; font-weight: 500; }
.confirm-ok { background: var(--primary); color: #fff; }
.confirm-cancel { background: var(--text-light); color: #fff; }

@media (max-width: 700px) {
    .scheme-row { flex-direction: column; gap: 1rem; }
    .divider { display: none; }
    .color-preview-large { flex-direction: column; align-items: stretch; }
    .preview-info { justify-content: center; }
    .delete-btn { align-self: center; }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .user-center-layout { flex-direction: column; padding: 0 16px 40px; }
    .bm-url { max-width: 150px; }
    .cards-row { flex-direction: column; }
    .cards-row .stat-card { width: 100%; }
    .records-section { flex-direction: column; }
    .records-section > div { width: 100%; }
}
