/* 游戏代练平台 - 公共样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* SEO优化：屏幕阅读器专用文本 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --success-color: #00b894;
    --danger-color: #d63031;
    --warning-color: #fdcb6e;
    --dark-color: #2d3436;
    --light-color: #dfe6e9;
    --white-color: #ffffff;
    --text-color: #2d3436;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* 纵向排列：导航→主内容→页脚，避免页脚被挤到右侧看不见 */
    align-items: stretch;
    justify-content: flex-start;
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-top: 0;
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 导航栏 */
.navbar {
    background: var(--white-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    position: relative;
}

.navbar .logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.navbar .nav-links {
    display: flex;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.navbar .nav-links li {
    margin: 0;
}

.navbar .nav-links a {
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    transition: all 0.3s;
    font-size: 14px;
    display: block;
    white-space: nowrap;
}

.navbar .nav-links a:hover {
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary-color);
}

/* 表单容器 */
.form-container {
    background: var(--white-color);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
}

.form-container h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 28px;
}

.form-container .subtitle {
    text-align: center;
    color: #636e72;
    margin-bottom: 30px;
    font-size: 14px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--light-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.form-group .error-message {
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.form-group.error input {
    border-color: var(--danger-color);
}

.form-group.error .error-message {
    display: block;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white-color);
}

.btn-primary:hover {
    background: #5f4dd4;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 92, 231, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white-color);
}

.btn-success {
    background: var(--success-color);
    color: var(--white-color);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white-color);
}

.btn-block {
    width: 100%;
    display: block;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 消息红点提示 */
.badge-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4757;
    margin-left: 4px;
    box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.25);
}

/* 提示消息 */
.alert {
    padding: 12px 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d5f4e6;
    color: #00b894;
    border: 1px solid #00b894;
}

.alert-error {
    background: #ffe5e5;
    color: #d63031;
    border: 1px solid #d63031;
}

.alert-warning {
    background: #fff4d9;
    color: #f39c12;
    border: 1px solid #f39c12;
}

.alert-info {
    background: #e3f2fd;
    color: #2980b9;
    border: 1px solid #2980b9;
}

/* 链接样式 */
.form-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--light-color);
    font-size: 14px;
    color: #636e72;
}

.form-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* 用户类型选择 */
.user-type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.user-type-option {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--light-color);
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.user-type-option:hover {
    border-color: var(--secondary-color);
}

.user-type-option.active {
    border-color: var(--primary-color);
    background: rgba(108, 92, 231, 0.1);
}

.user-type-option input[type="radio"] {
    display: none;
}

.user-type-option .icon {
    font-size: 30px;
    margin-bottom: 5px;
}

.user-type-option .label {
    font-weight: 600;
    font-size: 14px;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .form-container {
        padding: 25px 20px;
        margin: 20px auto;
        max-width: 100%;
        border-radius: 12px;
    }
    
    .form-container h1 {
        font-size: 24px;
    }
    
    .user-type-selector {
        flex-direction: column;
    }
    
    /* 导航栏移动端优化 */
    .navbar .container {
        padding: 12px 15px;
    }
    
    .navbar .logo {
        font-size: 18px;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .navbar .nav-links {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--white-color) !important; /* 不透明背景，避免透出页脚被误当菜单 */
        display: grid;
        grid-template-columns: 1fr 1fr; /* 一行两个菜单，首屏显示更多 */
        padding: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        gap: 8px;
        z-index: 9999; /* 高于页脚，确保菜单盖住整屏 */
        width: 100%;
    }
    
    .navbar .nav-links.active {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: calc(100vh - 56px); /* 占满屏幕剩余高度，确保所有菜单项可见或可滚动 */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    }
    /* 菜单打开时全屏遮罩，避免背后的页脚/主内容被误点或露出被挡住的文字 */
    .navbar .nav-links.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.35);
        z-index: -1;
        pointer-events: none;
    }
    .navbar .nav-links.active li {
        display: block !important;
    }
    /* 页脚层级低于导航，且移动端保证全宽，避免被挡或裁切 */
    footer {
        position: relative;
        z-index: 1;
        width: 100%;
        box-sizing: border-box;
        padding: 25px 0 !important;
        margin-top: 40px !important;
    }
    footer .container {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    footer p {
        font-size: 13px !important;
    }
    footer a {
        font-size: 13px !important;
    }
    
    /* 主内容区通用移动端样式（各页可被自身内联样式覆盖） */
    .main-container {
        margin: 0 auto;
        padding: 15px;
        padding-top: 70px;
        padding-bottom: 30px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    body > .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    .alert {
        padding: 12px 15px;
        font-size: 14px;
    }
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .navbar .nav-links li {
        width: auto;
        border-bottom: none;
        border: 1px solid #eee;
        border-radius: 8px;
        background: #fafafa;
    }
    
    .navbar .nav-links li:last-child {
        border-bottom: 1px solid #eee;
    }
    
    .navbar .nav-links a {
        padding: 12px 10px;
        font-size: 14px;
        width: 100%;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        min-height: 44px;
        box-sizing: border-box;
    }
    
    .navbar .nav-links a:hover {
        background: rgba(108, 92, 231, 0.1);
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    body {
        padding: 0;
    }
    
    .main-container {
        padding: 12px;
        padding-top: 60px;
        padding-bottom: 20px;
    }
    
    .form-container {
        padding: 20px 15px;
        margin: 10px;
        max-width: 100%;
    }
    
    .form-container h1 {
        font-size: 22px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 14px;
        min-height: 44px; /* 触摸友好的最小高度 */
    }
    
    footer {
        padding: 20px 0 !important;
    }
    footer p,
    footer a {
        font-size: 12px !important;
    }
    
    .navbar .logo {
        font-size: 16px;
    }
    
    .navbar .container {
        padding: 10px 15px;
    }
    
    .navbar .nav-links {
        top: 50px;
        left: 0 !important;
        right: 0 !important;
        padding: 10px;
        z-index: 9999;
        width: 100% !important;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .navbar .nav-links.active {
        max-height: calc(100vh - 50px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .navbar .nav-links a {
        padding: 10px 8px;
        font-size: 13px;
        min-height: 44px; /* 触摸友好的最小高度 */
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
}

/* 中等屏幕优化（平板） */
@media (min-width: 481px) and (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .form-container {
        max-width: 500px;
    }
}

/* 超大屏幕优化 */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
}

/* 通用响应式工具类 */
@media (max-width: 768px) {
    /* 隐藏桌面端元素 */
    .desktop-only {
        display: none !important;
    }
    
    /* 显示移动端元素 */
    .mobile-only {
        display: block !important;
    }
    
    /* 表格响应式：横向滚动，保留表头可读 */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table th,
    table td {
        white-space: nowrap;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* 图片响应式 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 按钮组响应式 */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* 表单响应式 */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    /* 主内容内标题与区块 */
    .main-container h1 {
        font-size: 1.35rem;
    }
    .main-container h2 {
        font-size: 1.2rem;
    }
    
    /* 弹层移动端：可滚动、留边距 */
    .modal-overlay {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding: 15px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .modal-overlay .modal {
        margin: auto 0;
        max-width: 100%;
        max-height: 90vh;
        overflow-y: auto;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加触摸目标大小 */
    .btn,
    .navbar .nav-links a,
    button,
    a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 移除hover效果，使用active */
    .btn:hover {
        transform: none;
    }
    
    .btn:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar .nav-links {
        max-height: 85vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    }
}
