/**
 * IT设备资产管理系统 - 前台移动端样式
 * 简洁大气 · 现代设计 · 优雅交互
 */

/* ==================== 基础变量 ==================== */
:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #f5222d;
    --purple: #722ed1;
    --orange: #fa8c16;
    
    --bg-page: #f5f7fa;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-placeholder: #bfbfbf;
    --border-color: #e8e8e8;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: 70px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==================== 顶部导航 ==================== */
.m-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

.m-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.m-header-left .m-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
}

.m-header-left .m-logo i {
    font-size: 1.4rem;
}

.m-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.m-user a,
.m-user .user-name {
    color: #fff;
    font-size: 0.9rem;
    opacity: 0.95;
}

/* ==================== 底部导航 ==================== */
.m-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #fff;
    display: flex;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.m-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.7rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.m-nav-item i {
    font-size: 1.4rem;
    margin-bottom: 4px;
    transition: transform 0.3s ease;
}

.m-nav-item.active {
    color: var(--primary);
}

.m-nav-item.active i {
    transform: translateY(-2px);
}

.m-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

/* ==================== 主内容区 ==================== */
.m-content {
    padding: 68px 16px 80px;
    min-height: 100vh;
}

/* ==================== 首页Hero区域 ==================== */
.m-home-hero {
    position: relative;
    padding: 24px 20px;
    margin: -68px -16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 32px 32px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Ccircle cx='150' cy='80' r='80' fill='rgba(255,255,255,0.1)'/%3E%3Ccircle cx='180' cy='160' r='60' fill='rgba(255,255,255,0.05)'/%3E%3C/svg%3E") no-repeat right center;
    background-size: contain;
}

.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hero-greeting .greeting-time {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    color: #fff;
    margin-bottom: 8px;
}

.hero-greeting h2 {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.hero-date {
    text-align: right;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    line-height: 1.8;
}

/* ==================== 统计卡片 ==================== */
.m-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.m-stat-card {
    background: var(--bg-card);
    padding: 18px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.m-stat-card:active {
    transform: scale(0.98);
}

.m-stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
}

.m-stat-card .stat-icon i {
    font-weight: 500;
}

.m-stat-primary .stat-icon {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.m-stat-warning .stat-icon {
    background: linear-gradient(135deg, var(--warning) 0%, #fa8c16 100%);
}

.m-stat-success .stat-icon {
    background: linear-gradient(135deg, var(--success) 0%, #389e0d 100%);
}

.m-stat-danger .stat-icon {
    background: linear-gradient(135deg, var(--danger) 0%, #cf1322 100%);
}

.m-stat-info .stat-num {
    color: var(--primary);
}

.m-stat-card .stat-info {
    flex: 1;
}

.m-stat-card .stat-num {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.m-stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ==================== 区块 ==================== */
.m-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.m-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
}

.m-section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.m-section-header h3 i {
    color: var(--primary);
}

.more-link {
    color: var(--text-placeholder);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.more-link:hover {
    color: var(--primary);
}

/* ==================== 快捷操作 ==================== */
.m-quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 16px;
}

.m-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    border-radius: var(--radius-md);
    background: var(--bg-page);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.m-action-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.m-action-item:active {
    transform: scale(0.96);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bg-gradient-blue {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
}

.bg-gradient-green {
    background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
}

.bg-gradient-orange {
    background: linear-gradient(135deg, #fa8c16 0%, #d46b08 100%);
}

.bg-gradient-purple {
    background: linear-gradient(135deg, #722ed1 0%, #5318a2 100%);
}

.bg-gradient-red {
    background: linear-gradient(135deg, #f5222d 0%, #cf1322 100%);
}

.bg-gradient-cyan {
    background: linear-gradient(135deg, #13c2c2 0%, #08979c 100%);
}

.m-action-item span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== 列表 ==================== */
.m-list {
    padding: 0;
}

.m-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s;
    background: #fff;
}

.m-list-item:last-child {
    border-bottom: none;
}

.m-list-item:active {
    background: var(--bg-page);
}

.m-list-item .item-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f0f5ff 0%, #e6f7ff 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1rem;
}

.item-main {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-sub {
    font-size: 0.78rem;
    color: var(--text-placeholder);
    display: flex;
    align-items: center;
    gap: 6px;
}

.item-sub .dot {
    opacity: 0.5;
}

.item-extra {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.m-list-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-placeholder);
    gap: 12px;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.m-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: var(--text-placeholder);
}

.empty-icon {
    width: 64px;
    height: 64px;
    background: var(--bg-page);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.empty-icon i {
    font-size: 1.8rem;
    color: var(--text-placeholder);
}

.m-list-empty p {
    font-size: 0.9rem;
}

/* ==================== 表单 ==================== */
.m-form {
    padding: 20px;
}

.m-form-group {
    margin-bottom: 20px;
}

.m-form-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.m-form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.3s;
    background: #fff;
}

.m-form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

.m-form-control::placeholder {
    color: var(--text-placeholder);
}

.m-select {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 16px center;
    appearance: none;
    cursor: pointer;
}

.m-select:focus {
    border-color: var(--primary);
}

/* ==================== 按钮 ==================== */
.m-btn {
    display: block;
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.m-btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(24, 144, 255, 0.35);
}

.m-btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.25);
}

.m-btn-secondary {
    background: var(--bg-page);
    color: var(--text-secondary);
    margin-top: 12px;
}

.m-btn-secondary:active {
    background: var(--border-color);
}

.m-btn-block {
    width: 100%;
}

/* ==================== 徽章 ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.72rem;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-warning { 
    background: #fffbe6; 
    color: #faad14; 
}

.badge-info { 
    background: #e6f7ff; 
    color: var(--primary); 
}

.badge-success { 
    background: #f6ffed; 
    color: var(--success); 
}

.badge-danger { 
    background: #fff1f0; 
    color: var(--danger); 
}

.badge-default { 
    background: var(--bg-page); 
    color: var(--text-placeholder); 
}

/* ==================== 搜索 ==================== */
.m-search-bar {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: #fff;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.m-search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.m-search-bar input:focus {
    border-color: var(--primary);
}

.m-search-bar button {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

/* ==================== 设备卡片 ==================== */
.m-device-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.m-device-card:active {
    transform: scale(0.99);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.device-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.device-sn {
    font-size: 0.8rem;
    color: var(--text-placeholder);
    margin-top: 4px;
}

.device-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.device-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.device-tag {
    padding: 5px 12px;
    background: var(--bg-page);
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ==================== 登录页 ==================== */
.m-login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
}

.m-login-logo {
    text-align: center;
    margin-bottom: 50px;
}

.m-login-logo .logo-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    backdrop-filter: blur(10px);
}

.m-login-logo i {
    font-size: 2.8rem;
    color: #fff;
}

.m-login-logo h1 {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 2px;
}

.m-login-logo p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
    margin-top: 8px;
}

.m-login-form {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    box-shadow: var(--shadow-lg);
}

.m-login-form .m-form-group {
    margin-bottom: 24px;
}

.m-login-form .m-form-control {
    padding-left: 48px;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-placeholder);
    font-size: 1.1rem;
}

.m-login-form .m-btn-primary {
    margin-top: 10px;
    padding: 16px;
}

.m-login-footer {
    text-align: center;
    margin-top: 40px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

/* ==================== 空状态 ==================== */
.m-empty {
    text-align: center;
    padding: 60px 20px;
}

.m-empty-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-page);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.m-empty-icon i {
    font-size: 2.5rem;
    color: var(--text-placeholder);
}

.m-empty-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ==================== 响应式 ==================== */
@media screen and (max-width: 375px) {
    .m-quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-greeting h2 {
        font-size: 1.4rem;
    }
}

@media screen and (min-width: 768px) {
    .m-content {
        max-width: 600px;
        margin: 0 auto;
        padding-left: 0;
        padding-right: 0;
    }
    
    .m-home-hero {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0 0 32px 32px;
    }
    
    .m-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    
    .m-header {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }
}

/* ==================== 搜索页面 ==================== */
.m-search-hero {
    position: relative;
    padding: 24px 20px;
    margin: -68px -16px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 32px 32px;
    overflow: hidden;
}

.m-search-hero .hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding-top: 10px;
}

.m-search-hero h2 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.m-search-hero h2 i {
    font-size: 1.5rem;
}

.m-search-hero p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
}

.m-search-box {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: #fff;
    margin: -20px 16px 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 10;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-placeholder);
    font-size: 1rem;
}

.search-input-wrapper input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

.search-input-wrapper input:focus {
    border-color: var(--primary);
}

.m-search-box button {
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.m-search-box button:active {
    transform: scale(0.96);
}

.m-search-tip {
    text-align: center;
    padding: 40px 20px;
}

.m-search-tip .tip-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.m-search-tip .tip-icon i {
    font-size: 1.8rem;
    color: #fff;
}

.m-search-tip p {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.m-search-tip span {
    font-size: 0.85rem;
    color: var(--text-placeholder);
}

.m-device-list .m-device-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 0 16px 12px;
    box-shadow: var(--shadow-sm);
}
