/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

/* 页面切换 */
.page {
    display: none;
    min-height: 100vh;
    padding-top: 60px;
}

.page.active {
    display: block;
}

/* 语言切换 */
.language-switch {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 2px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.lang-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 18px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.lang-btn.active {
    background: #667eea;
    color: white;
}

.lang-btn:hover:not(.active) {
    background: rgba(102, 126, 234, 0.1);
}

/* 登录页面 */
.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.logo img {
    width: 300px;
    height: 40px;
    margin-bottom: 20px;
}

.login-card h2 {
    margin-bottom: 30px;
    color: #333;
    font-size: 28px;
    font-weight: 600;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
}

/* 选择框样式 */
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23667eea" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    margin: 25px 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    pointer-events: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
    margin-top: -1px;
    position: relative;
    transition: all 0.3s ease;
    background: white;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.checkbox-label input:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkbox-label input:checked + .checkmark::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    top: 2px;
    left: 6px;
}

.checkbox-label input:focus + .checkmark {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-label:hover .checkmark {
    border-color: #667eea;
}

#privacy-link {
    color: #667eea;
    text-decoration: none;
    margin-left: 4px;
}

#privacy-link:hover {
    text-decoration: underline;
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 通用主按钮 */
.primary-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 忘记密码链接 */
.forgot-password {
    text-align: center;
    margin-top: 15px;
}

.forgot-password a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.forgot-password a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

/* 返回登录和重新发送验证码链接 */
.back-to-login,
.resend-code {
    text-align: center;
    margin-top: 15px;
}

.back-to-login a,
.resend-code a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.back-to-login a:hover,
.resend-code a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

/* 忘记密码页面描述文字 */
.login-card p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
    text-align: center;
}

.login-card p #email-display {
    color: #667eea;
    font-weight: 600;
}

/* 个人信息页面 */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.profile-header h2 {
    font-size: 24px;
    color: #333;
}

.logout-btn {
    padding: 8px 16px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #ff5252;
}

.menu-list {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: #f8f9ff;
}

.menu-item span {
    font-size: 16px;
}

.arrow {
    color: #999;
    font-size: 18px;
}

/* 区块标题 */
.section-title {
    margin: 16px 4px 8px 4px;
    color: #f0f0f0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.9;
}

/* 表单容器卡片 */
.form-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.form-actions {
    margin-top: 10px;
}

/* 页面头部 */
.page-header {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.back-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-right: 15px;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #f0f0f0;
}

.page-header h2 {
    font-size: 20px;
    color: #333;
}

/* 设备列表 */
.devices-list {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.device-item {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.device-item:last-child {
    border-bottom: none;
}

.device-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.device-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-details {
    color: #666;
    font-size: 14px;
}

.device-id {
    color: #999;
    font-size: 12px;
    font-family: monospace;
}

/* 订阅状态样式 */
.subscription-status {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-label {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
    width: fit-content;
}

.status-label.active {
    background: #e8f5e8;
    color: #2e7d32;
}

.status-label.expired {
    background: #ffebee;
    color: #c62828;
}

.expiry-date {
    font-size: 12px;
    font-weight: 500;
}

.expiry-date.valid-date {
    color: #2e7d32;
}

.expiry-date.expired-date {
    color: #c62828;
    font-weight: 600;
}

/* 订阅记录列表 */
.subscription-list {
    margin-bottom: 20px;
}

.subscription-item {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.order-id {
    font-size: 14px;
    color: #666;
    font-family: monospace;
}

.amount {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.subscription-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 14px;
    color: #666;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 2px;
}

.detail-value {
    font-weight: 500;
    color: #333;
}

.period-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.product-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #f3e5f5;
    color: #7b1fa2;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.pay-method-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e8f5e8;
    color: #2e7d32;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* 加载动画 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading span {
    color: #666;
    font-size: 14px;
}

/* 错误消息 - 弹窗样式 */
.error-message {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffebee;
    color: #c62828;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
    border-left: 4px solid #c62828;
    display: none; /* 默认隐藏 */
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 280px;
    max-width: 90vw;
    opacity: 1;
}

/* 成功信息样式 */
.success-message {
    background: #e8f5e8 !important;
    color: #2e7d32 !important;
    border-left: 4px solid #2e7d32 !important;
}

/* 没有更多数据 */
.no-more-data {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 14px;
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .login-card {
        padding: 30px 20px;
    }
    
    .language-switch {
        top: 15px;
        right: 15px;
    }
    
    .subscription-details {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .device-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
