/* ============================================================
 * Galaxy UI 组件库 - Web端统一样式
 * 基于Galaxy开源UI组件库设计风格
 * 包含：按钮、卡片、开关、输入框 四类核心组件
 * 
 * 使用说明：
 * 1. 在HTML中引入本CSS文件
 * 2. 给元素添加对应的class即可使用
 * 3. 所有组件都支持悬停、点击、聚焦等原生交互动效
 * ============================================================ */


/* ============================================================
 * 一、按钮组件 (Button)
 * 变体：primary(主要)、secondary(次要)、danger(危险)、text(文字)
 * 尺寸：large(大)、default(默认)、small(小)
 * 状态：default、hover、active、disabled、loading
 * ============================================================ */

/* 按钮基础样式 */
.gx-btn {
    /* 布局 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    
    /* 尺寸 */
    padding: 10px 24px;
    min-width: 80px;
    height: 40px;
    
    /* 排版 */
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    
    /* 外观 */
    border: none;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    
    /* 动效 - Galaxy风格平滑过渡 */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* 按钮涟漪效果（点击波纹） */
.gx-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.gx-btn:active::after {
    width: 300px;
    height: 300px;
}

/* 主要按钮 - Galaxy渐变风格 */
.gx-btn-primary {
    background: linear-gradient(135deg, #111111 0%, #444444 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(17, 17, 17, 0.4);
}

.gx-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 17, 17, 0.5);
}

.gx-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(17, 17, 17, 0.3);
}

/* 次要按钮 - 描边风格 */
.gx-btn-secondary {
    background: #ffffff;
    color: #111111;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.gx-btn-secondary:hover {
    border-color: #111111;
    background: #f8faff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(17, 17, 17, 0.15);
}

.gx-btn-secondary:active {
    transform: translateY(0);
    background: #f0f4ff;
}

/* 危险按钮 */
.gx-btn-danger {
    background: #9F2F2D;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(159, 47, 45, 0.18);
}

.gx-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
}

.gx-btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

/* 文字按钮 */
.gx-btn-text {
    background: transparent;
    color: #111111;
    padding: 8px 16px;
    height: auto;
    min-width: auto;
}

.gx-btn-text:hover {
    background: #f0f4ff;
}

.gx-btn-text:active {
    background: #e0e8ff;
}

/* 按钮尺寸 */
.gx-btn-large {
    padding: 14px 32px;
    height: 48px;
    font-size: 16px;
    border-radius: 12px;
}

.gx-btn-small {
    padding: 6px 16px;
    height: 32px;
    font-size: 12px;
    border-radius: 8px;
    min-width: 60px;
}

/* 禁用状态 */
.gx-btn:disabled,
.gx-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 加载状态 */
.gx-btn-loading {
    pointer-events: none;
}

.gx-btn-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: gx-spin 0.8s linear infinite;
}

@keyframes gx-spin {
    to { transform: rotate(360deg); }
}


/* ============================================================
 * 二、卡片组件 (Card)
 * 变体：default(默认)、hover(悬停提升)、bordered(描边)
 * 部分：header(头部)、body(内容)、footer(底部)
 * ============================================================ */

/* 卡片基础样式 */
.gx-card {
    /* 布局 */
    display: flex;
    flex-direction: column;
    
    /* 外观 */
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    
    /* Galaxy风格阴影 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04),
                0 4px 12px rgba(0, 0, 0, 0.03);
    
    /* 动效 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* 悬停提升效果 */
.gx-card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08),
                0 16px 48px rgba(0, 0, 0, 0.06);
    border-color: #e2e8f0;
}

/* 描边卡片（无阴影） */
.gx-card-bordered {
    box-shadow: none;
    border: 1.5px solid #e2e8f0;
}

.gx-card-bordered:hover {
    border-color: #cbd5e1;
}

/* 卡片头部 */
.gx-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gx-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gx-card-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* 卡片内容 */
.gx-card-body {
    padding: 24px;
    flex: 1;
}

/* 卡片底部 */
.gx-card-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* 卡片渐变顶部装饰条 */
.gx-card-gradient-top {
    position: relative;
}

.gx-card-gradient-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #111111, #555555);
}


/* ============================================================
 * 三、开关组件 (Toggle/Switch)
 * 状态：off(关)、on(开)、disabled(禁用)
 * 尺寸：default(默认)、small(小)
 * ============================================================ */

/* 开关容器 */
.gx-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
    user-select: none;
}

/* 隐藏原生checkbox */
.gx-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

/* 开关轨道 */
.gx-switch-slider {
    position: absolute;
    inset: 0;
    background: #e2e8f0;
    border-radius: 28px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 开关滑块 */
.gx-switch-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 开启状态 - Galaxy渐变 */
.gx-switch input:checked + .gx-switch-slider {
    background: linear-gradient(135deg, #111111 0%, #444444 100%);
    box-shadow: 0 2px 8px rgba(17, 17, 17, 0.4);
}

.gx-switch input:checked + .gx-switch-slider::before {
    transform: translateX(24px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 悬停效果 */
.gx-switch:hover .gx-switch-slider {
    background: #cbd5e1;
}

.gx-switch:hover input:checked + .gx-switch-slider {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

/* 禁用状态 */
.gx-switch input:disabled + .gx-switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 小尺寸开关 */
.gx-switch-small {
    width: 40px;
    height: 22px;
}

.gx-switch-small .gx-switch-slider {
    border-radius: 22px;
}

.gx-switch-small .gx-switch-slider::before {
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
}

.gx-switch-small input:checked + .gx-switch-slider::before {
    transform: translateX(18px);
}

/* 开关文字标签 */
.gx-switch-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
}


/* ============================================================
 * 四、输入框组件 (Input)
 * 类型：text(文本)、password(密码)、search(搜索)
 * 状态：default、focus、error、disabled
 * 尺寸：large(大)、default(默认)、small(小)
 * ============================================================ */

/* 输入框容器 */
.gx-input-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 输入框标签 */
.gx-input-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-left: 2px;
}

/* 输入框基础样式 */
.gx-input {
    /* 布局 */
    width: 100%;
    padding: 10px 14px;
    height: 42px;
    box-sizing: border-box;
    
    /* 排版 */
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1e293b;
    line-height: 1.5;
    
    /* 外观 */
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    
    /* 动效 */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 占位符样式 */
.gx-input::placeholder {
    color: #94a3b8;
}

/* 聚焦状态 - Galaxy发光效果 */
.gx-input:focus {
    border-color: #111111;
    box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.1),
                0 2px 8px rgba(17, 17, 17, 0.1);
}

/* 悬停状态 */
.gx-input:hover:not(:focus):not(:disabled) {
    border-color: #cbd5e1;
}

/* 错误状态 */
.gx-input-error {
    border-color: #9F2F2D !important;
}

.gx-input-error:focus {
    box-shadow: 0 0 0 4px rgba(245, 87, 108, 0.1),
                0 2px 8px rgba(245, 87, 108, 0.1) !important;
}

/* 错误提示文字 */
.gx-input-error-msg {
    font-size: 12px;
    color: #9F2F2D;
    margin-left: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 禁用状态 */
.gx-input:disabled {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

/* 输入框尺寸 */
.gx-input-large {
    padding: 14px 18px;
    height: 50px;
    font-size: 16px;
    border-radius: 12px;
}

.gx-input-small {
    padding: 6px 12px;
    height: 32px;
    font-size: 12px;
    border-radius: 8px;
}

/* 带图标输入框 */
.gx-input-with-icon {
    position: relative;
}

.gx-input-with-icon .gx-input {
    padding-left: 42px;
}

.gx-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.25s ease;
}

.gx-input-with-icon .gx-input:focus + .gx-input-icon,
.gx-input-with-icon:focus-within .gx-input-icon {
    color: #111111;
}

/* 带后缀按钮输入框 */
.gx-input-suffix {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

/* 文本域 */
.gx-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
    padding: 12px 14px;
}


/* ============================================================
 * 五、工具类 (Utility)
 * 常用间距、对齐、颜色等辅助类
 * ============================================================ */

/* 间距 */
.gx-mt-1 { margin-top: 4px; }
.gx-mt-2 { margin-top: 8px; }
.gx-mt-3 { margin-top: 12px; }
.gx-mt-4 { margin-top: 16px; }
.gx-mb-1 { margin-bottom: 4px; }
.gx-mb-2 { margin-bottom: 8px; }
.gx-mb-3 { margin-bottom: 12px; }
.gx-mb-4 { margin-bottom: 16px; }

/*  flex 布局 */
.gx-flex { display: flex; }
.gx-flex-center { display: flex; align-items: center; justify-content: center; }
.gx-flex-between { display: flex; align-items: center; justify-content: space-between; }
.gx-flex-col { display: flex; flex-direction: column; }
.gx-gap-1 { gap: 4px; }
.gx-gap-2 { gap: 8px; }
.gx-gap-3 { gap: 12px; }
.gx-gap-4 { gap: 16px; }

/* 文字 */
.gx-text-center { text-align: center; }
.gx-text-muted { color: #64748b; }
.gx-text-primary { color: #111111; }
.gx-text-danger { color: #9F2F2D; }
.gx-text-success { color: #10b981; }

/* 徽章 */
.gx-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.gx-badge-primary { background: #dbeafe; color: #1d4ed8; }
.gx-badge-success { background: #dcfce7; color: #166534; }
.gx-badge-danger { background: #fee2e2; color: #991b1b; }
.gx-badge-warning { background: #ffedd5; color: #9a3412; }
.gx-badge-gray { background: #f1f5f9; color: #64748b; }


/* ============================================================
 * 六、动画关键帧 (Animations)
 * Galaxy风格的过渡动画
 * ============================================================ */

@keyframes gx-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gx-slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes gx-scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.gx-animate-fadeIn { animation: gx-fadeIn 0.4s ease-out; }
.gx-animate-slideIn { animation: gx-slideIn 0.4s ease-out; }
.gx-animate-scaleIn { animation: gx-scaleIn 0.3s ease-out; }
