/**
 * Custom Login Styler - 登录页面样式
 *
 * @package CustomLoginStyler
 */

/* ========== 背景图基础设置 ========== */
/* 确保body层级正确，背景伪元素能正常显示 */
body.login {
    position: relative;
    min-height: 100vh;
}

body.login::before {
    pointer-events: none; /* 不影响交互 */
}

/* ========== 深色模式切换按钮 ========== */
.cls-theme-toggle {
    position: fixed;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1;
}

.cls-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.cls-theme-toggle:active {
    transform: translateY(0);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.cls-theme-toggle:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.cls-theme-toggle .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.cls-theme-toggle .cls-toggle-label {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

/* ========== 按钮位置 ========== */
.cls-btn-bottom-right {
    bottom: 24px;
    right: 24px;
}

.cls-btn-bottom-left {
    bottom: 24px;
    left: 24px;
}

.cls-btn-top-right {
    top: 24px;
    right: 24px;
}

.cls-btn-top-left {
    top: 24px;
    left: 24px;
}

/* ========== 深色模式下的按钮 ========== */
body.login.cls-theme-dark .cls-theme-toggle {
    background: rgba(30, 30, 46, 0.85);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.login.cls-theme-dark .cls-theme-toggle:hover {
    background: rgba(30, 30, 46, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.login.cls-theme-dark .cls-theme-toggle .dashicons {
    color: #e0e0e0;
}

body.login.cls-theme-dark .cls-theme-toggle .cls-toggle-label {
    color: #e0e0e0;
}

/* ========== 自定义品牌区域 ========== */
.cls-custom-logo-wrap {
    text-align: center;
    margin-bottom: 16px;
}

.cls-custom-logo-wrap a {
    display: inline-block;
    text-decoration: none;
    box-shadow: none;
}

.cls-custom-logo-wrap img {
    max-width: 280px;
    max-height: 100px;
    width: auto;
    height: auto;
    display: inline-block;
    /* 裂图兜底：用alt文字替代 */
    font-size: 0;
    color: transparent;
    position: relative;
}

.cls-custom-logo-wrap img::after {
    /* 如果图片加载失败，通过伪元素显示alt文字 */
    /* 大多数浏览器中img的伪元素不生效，这是backup方案 */
    content: attr(alt);
    font-size: 14px;
    color: #c3c4c7;
    display: block;
    text-align: center;
}

.cls-site-name-display {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: #3c434a;
    margin-bottom: 12px;
    line-height: 1.3;
}

body.login.cls-theme-dark .cls-site-name-display {
    color: #e0e0e0;
}

/* ========== 深色模式适配 ========== */
body.login.cls-theme-dark #login h1 a {
    /* 如果默认logo还在（没自定义logo且没隐藏），在深色下加个滤镜 */
    filter: brightness(0.9);
}

body.login.cls-theme-dark #loginform {
    /* 保持登录框为浅色卡片，保证表单可读性 */
}

body.login.cls-theme-dark #nav a,
body.login.cls-theme-dark #backtoblog a {
    color: #a7aaad !important;
}

body.login.cls-theme-dark #nav a:hover,
body.login.cls-theme-dark #backtoblog a:hover {
    color: #72aee6 !important;
}

/* ========== 移动端适配 ========== */
@media (max-width: 600px) {
    .cls-theme-toggle {
        padding: 6px 10px;
        font-size: 12px;
    }
    .cls-theme-toggle .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
    .cls-theme-toggle .cls-toggle-label {
        display: none; /* 移动端只显示图标 */
    }
    .cls-btn-bottom-right {
        bottom: 12px;
        right: 12px;
    }
    .cls-btn-bottom-left {
        bottom: 12px;
        left: 12px;
    }
    .cls-btn-top-right {
        top: 12px;
        right: 12px;
    }
    .cls-btn-top-left {
        top: 12px;
        left: 12px;
    }
}
