/* ==========================================================================
   登录/注册/找回页样式覆盖（GitHub Primer 风格）
   通过主题 plugins.php 的 login_head 钩子注入，覆盖 SB Admin 默认样式
   明暗：优先 localStorage 'theme'（与前台主题同键），回退系统偏好
   ========================================================================== */

:root {
    --ghl-bg: #f6f8fa;
    --ghl-card: #ffffff;
    --ghl-fg: #1f2328;
    --ghl-muted: #59636e;
    --ghl-border: #d0d7de;
    --ghl-accent: #0969da;
    --ghl-green: #1f883d;
    --ghl-green-hover: #1a7f37;
    --ghl-input-bg: #ffffff;
    --ghl-danger-bg: #ffebe9;
    --ghl-danger-fg: #cf222e;
    --ghl-danger-border: rgba(255, 129, 130, 0.4);
    --ghl-success-bg: #dafbe1;
    --ghl-success-fg: #1a7f37;
    --ghl-success-border: rgba(74, 194, 107, 0.4);
    --ghl-focus-ring: rgba(9, 105, 218, 0.3);
    --ghl-header: #010409;
    --ghl-header-fg: #f0f6fc;
}

[data-ghl="dark"] {
    --ghl-bg: #0d1117;
    --ghl-card: #161b22;
    --ghl-fg: #e6edf3;
    --ghl-muted: #8b949e;
    --ghl-border: #30363d;
    --ghl-accent: #58a6ff;
    --ghl-green: #238636;
    --ghl-green-hover: #2ea043;
    --ghl-input-bg: #0d1117;
    --ghl-danger-bg: rgba(248, 81, 73, 0.15);
    --ghl-danger-fg: #f85149;
    --ghl-danger-border: rgba(248, 81, 73, 0.4);
    --ghl-success-bg: rgba(46, 160, 67, 0.15);
    --ghl-success-fg: #3fb950;
    --ghl-success-border: rgba(46, 160, 67, 0.4);
    --ghl-focus-ring: rgba(31, 111, 235, 0.4);
}

/* ---------- 页面基底 ---------- */
body.bg-gradient-gray {
    background-color: var(--ghl-bg) !important;
    background-image: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji" !important;
    color: var(--ghl-fg);
}

/* 顶部黑色品牌栏（fixed 不影响表单流） */
body.bg-gradient-gray::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--ghl-header);
    z-index: 10;
}

body.bg-gradient-gray::after {
    content: "";
    position: fixed;
    top: 16px;
    left: 16px;
    width: 32px;
    height: 32px;
    z-index: 11;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23f0f6fc'%3E%3Cpath d='M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.16.73.76.82 1.24.16.71.67 2.09 2.64 1.51 0 .98.01 1.9.01 2.18 0 .21-.15.46-.55.38A8.013 8.013 0 0 1 0 8c0-4.42 3.58-8 8-8Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* 为顶栏留出空间 */
body.bg-gradient-gray .container.min-vh-100 {
    padding-top: 64px;
}

/* ---------- 卡片 ---------- */
body.bg-gradient-gray .card {
    background-color: var(--ghl-card) !important;
    border: 1px solid var(--ghl-border) !important;
    border-radius: 6px !important;
    box-shadow: 0 1px 2px rgba(31, 35, 40, 0.06) !important;
    color: var(--ghl-fg);
}

body.bg-gradient-gray .card .h4 {
    font-size: 24px !important;
    font-weight: 600 !important;
    color: var(--ghl-fg) !important;
    letter-spacing: -0.01em;
}

/* 卡片内 logo（标题上方 Octocat） */
body.bg-gradient-gray .card .text-center:first-child::before {
    content: "";
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%231f2328' d='M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.16.73.76.82 1.24.16.71.67 2.09 2.64 1.51 0 .98.01 1.9.01 2.18 0 .21-.15.46-.55.38A8.013 8.013 0 0 1 0 8c0-4.42 3.58-8 8-8Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

[data-ghl="dark"] body.bg-gradient-gray .card .text-center:first-child::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23e6edf3' d='M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.16.73.76.82 1.24.16.71.67 2.09 2.64 1.51 0 .98.01 1.9.01 2.18 0 .21-.15.46-.55.38A8.013 8.013 0 0 1 0 8c0-4.42 3.58-8 8-8Z'/%3E%3C/svg%3E");
}

/* ---------- 提示条（Primer flash 风格） ---------- */
body.bg-gradient-gray .alert {
    border-radius: 6px !important;
    border: 1px solid !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
}

body.bg-gradient-gray .alert-danger {
    background-color: var(--ghl-danger-bg) !important;
    border-color: var(--ghl-danger-border) !important;
    color: var(--ghl-danger-fg) !important;
}

body.bg-gradient-gray .alert-success {
    background-color: var(--ghl-success-bg) !important;
    border-color: var(--ghl-success-border) !important;
    color: var(--ghl-success-fg) !important;
}

/* ---------- 输入框 ---------- */
body.bg-gradient-gray .form-control {
    background-color: var(--ghl-input-bg) !important;
    border: 1px solid var(--ghl-border) !important;
    border-radius: 6px !important;
    color: var(--ghl-fg) !important;
    font-size: 14px !important;
    line-height: 20px !important;
    padding: 5px 12px !important;
    height: auto !important;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

body.bg-gradient-gray .form-control::placeholder {
    color: var(--ghl-muted);
}

body.bg-gradient-gray .form-control:focus {
    border-color: var(--ghl-accent) !important;
    box-shadow: 0 0 0 3px var(--ghl-focus-ring) !important;
    outline: none;
}

/* ---------- 复选框 ---------- */
body.bg-gradient-gray .custom-control-label {
    color: var(--ghl-fg);
    font-size: 14px;
}

body.bg-gradient-gray .custom-control-label::before {
    background-color: var(--ghl-input-bg);
    border: 1px solid var(--ghl-border);
}

body.bg-gradient-gray .custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--ghl-green);
    border-color: var(--ghl-green);
}

/* ---------- 按钮：GitHub 绿色 sign in ---------- */
body.bg-gradient-gray .btn-primary.btn-user {
    background-color: var(--ghl-green) !important;
    border: 1px solid rgba(31, 35, 40, 0.15) !important;
    border-radius: 6px !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 20px !important;
    padding: 5px 16px !important;
    transition: background-color 0.12s ease;
}

body.bg-gradient-gray .btn-primary.btn-user:hover {
    background-color: var(--ghl-green-hover) !important;
}

body.bg-gradient-gray .btn-primary.btn-user:active {
    transform: scale(0.98);
}

/* ---------- 链接 ---------- */
body.bg-gradient-gray a {
    color: var(--ghl-accent);
}

body.bg-gradient-gray a:hover {
    color: var(--ghl-accent);
    text-decoration: underline;
}

body.bg-gradient-gray .text-gray-900,
body.bg-gradient-gray .text-gray-800 {
    color: var(--ghl-fg) !important;
}

body.bg-gradient-gray hr {
    border-color: var(--ghl-border);
}

/* 验证码图片对齐 */
body.bg-gradient-gray #checkcode {
    border-radius: 6px;
    border: 1px solid var(--ghl-border);
    vertical-align: middle;
    cursor: pointer;
}

/* 移动端 */
@media (max-width: 576px) {
    body.bg-gradient-gray .col-lg-12.p-5 {
        padding: 24px 20px !important;
    }
}
