/* Auth portal theme settings (aligned with user backend) */
.layui-theme-option,
.layui-sidebar-option {
    width: 100%;
    height: 42px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    border: 2px solid #e2e2e2;
}

.layui-theme-option:hover,
.layui-sidebar-option:hover {
    border-color: #009688;
    box-shadow: 0 2px 4px rgba(0, 150, 136, 0.2);
}

.layui-theme-option.active,
.layui-sidebar-option.active {
    border-color: #009688 !important;
    box-shadow: 0 0 0 2px rgba(0, 150, 136, 0.15);
}

.layui-theme-option.active::after,
.layui-sidebar-option.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #009688;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}

.theme-color-picker-wrap {
    position: relative;
    width: 100%;
    max-width: 240px;
}

.theme-color-picker-label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    margin: 0;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    background: #fafafa;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.theme-color-picker-label:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 150, 136, 0.15);
    border-color: #009688;
}

.theme-color-picker-preview {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    background: #ffffff;
    transition: transform 0.25s ease;
}

.theme-color-picker-text {
    font-size: 13px;
    color: #666;
    user-select: none;
}

.theme-color-input-native {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 44px !important;
    opacity: 0.01 !important;
    cursor: pointer !important;
    z-index: 5 !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    -webkit-appearance: none;
    appearance: none;
}

/* PC 端：右上角悬浮主题按钮（与后台一致） */
body.auth-portal-page .auth-theme-fab-wrap {
    display: none;
}

body.auth-portal-page .auth-theme-fab-pc {
    display: none;
}

body.auth-portal-page .auth-topbar-theme-btn {
    display: none;
    font-size: 24px;
    line-height: 1;
    color: #009688;
    cursor: pointer;
    padding: 4px;
    margin: 0;
    width: 34px;
    height: 34px;
    text-align: center;
    border: none;
    background: none;
    box-shadow: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    vertical-align: middle;
}

body.auth-portal-page .auth-topbar-theme-btn:active {
    opacity: 0.7;
}

.auth-theme-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2290;
}

body.auth-theme-open .auth-theme-overlay {
    display: block;
}

.auth-theme-panel {
    display: none;
    position: fixed;
    z-index: 2300;
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

body.auth-theme-open .auth-theme-panel {
    display: block;
    animation: authThemePanelIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes authThemePanelIn {
    0% { opacity: 0; transform: translateY(-8px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 768px) {
    body.auth-portal-page .auth-theme-fab-wrap {
        display: block;
    }

    body.auth-portal-page .auth-theme-fab-pc {
        display: flex;
        position: fixed;
        right: 16px;
        top: 16px;
        z-index: 2200;
        width: 42px;
        height: 42px;
        margin: 0;
        padding: 0;
        border: none;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        color: #009688;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    body.auth-portal-page .auth-theme-fab-pc .layui-icon {
        font-size: 20px;
        line-height: 1;
    }

    body.auth-portal-page .auth-theme-fab-pc:hover {
        transform: scale(1.06);
        box-shadow: 0 6px 20px rgba(0, 150, 136, 0.25);
    }

    body.auth-portal-page .auth-topbar-theme-btn {
        display: none !important;
    }

    body.auth-portal-page .auth-theme-panel {
        right: 16px;
        top: 66px;
        width: 300px;
        max-height: calc(100vh - 82px);
        overflow-y: auto;
        border-radius: 8px;
    }
}

@media (max-width: 767.98px) {
    body.auth-portal-page .auth-theme-fab-wrap,
    body.auth-portal-page .auth-theme-fab-pc {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        position: absolute !important;
        left: -9999px !important;
        top: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
    }

    body.auth-portal-page .auth-mobile-topbar .auth-topbar-theme-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    body.auth-portal-page .auth-theme-panel {
        left: 10px;
        right: 10px;
        top: 58px;
        transform: none;
        max-height: calc(100vh - 68px);
        overflow-y: auto;
        border-radius: 8px;
    }

    body.auth-theme-open .auth-theme-panel {
        animation: authThemePanelInMobile 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    }

    @keyframes authThemePanelInMobile {
        0% { opacity: 0; transform: translateY(-8px) scale(0.96); }
        100% { opacity: 1; transform: translateY(0) scale(1); }
    }

    .auth-theme-panel.is-color-picking {
        top: 10px;
        transform: none;
        max-height: calc(100vh - 20px);
    }

    body.auth-theme-open .auth-theme-panel.is-color-picking {
        animation: authThemePanelIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    }
}

.auth-theme-panel-header {
    background: #f8f9fa;
    color: #333;
    padding: 12px 15px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-theme-panel-header h6 {
    margin: 0;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.auth-theme-panel-close {
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.auth-theme-panel-close:hover {
    color: #333;
}

.auth-theme-panel-body {
    padding: 15px;
}

.auth-theme-panel-body .layui-form-label {
    width: 100%;
    padding: 0;
    font-size: 13px;
    color: #666;
    text-align: center;
    margin-bottom: 10px;
}

.auth-theme-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.auth-theme-section + .auth-theme-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.auth-theme-swatches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 240px;
    width: 100%;
}
