/**
 * 移动端增强CSS框架
 * 版本: 2.0
 * 最后更新: 2025-01-XX
 * 
 * 包含17个主要组件模块:
 * 1. CSS变量与设计规范
 * 2. 基础样式与安全区域
 * 3. 顶部导航
 * 4. 底部导航
 * 5. 表单优化
 * 6. 渐变按钮
 * 7. 卡片组件
 * 8. 表格响应式
 * 9. 徽章系统
 * 10. 提示框
 * 11. 模态框
 * 12. 分页
 * 13. 加载状态
 * 14. 工具类
 * 15. 无障碍
 * 16. 打印样式
 * 17. 深色模式准备
 */

/* ========================================
   1. CSS变量与设计规范 (Design Tokens)
   ======================================== */
:root {
    /* 颜色系统 */
    --mobile-primary: #007bff;
    --mobile-primary-dark: #0056b3;
    --mobile-primary-light: #cce5ff;
    --mobile-success: #28a745;
    --mobile-danger: #dc3545;
    --mobile-warning: #ffc107;
    --mobile-info: #17a2b8;
    --mobile-dark: #343a40;
    --mobile-light: #f8f9fa;
    
    /* 渐变色 */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-danger: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --gradient-info: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    /* 触摸目标 */
    --touch-target-size: 48px;
    --touch-target-min: 44px;
    
    /* 间距系统 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-base: 16px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;
    --spacing-2xl: 32px;
    
    /* 圆角系统 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-round: 50%;
    
    /* 阴影系统 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-button: 0 4px 12px rgba(102, 126, 234, 0.4);
    
    /* 字体系统 */
    --font-xs: 12px;
    --font-sm: 14px;
    --font-base: 16px;
    --font-lg: 18px;
    --font-xl: 20px;
    --font-2xl: 24px;
    --font-3xl: 32px;
    
    /* 动画 */
    --transition-speed: 0.3s;
    --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index层级 */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-tooltip: 1070;
}

/* ========================================
   2. 基础样式与安全区域
   ======================================== */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--font-base);
    line-height: 1.5;
    color: #333;
    background-color: #f5f7fa;
    overflow-x: hidden;
}

/* iOS安全区域适配 */
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* 移动端内容区域 */
.mobile-content {
    padding-bottom: 80px; /* 为底部导航留出空间 */
    min-height: 100vh;
}

/* ========================================
   3. 顶部导航
   ======================================== */
.mobile-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    background: var(--gradient-primary);
    color: white;
    padding: var(--spacing-base);
    box-shadow: var(--shadow-md);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.mobile-header-title {
    font-size: var(--font-2xl);
    font-weight: 600;
    margin: 0;
    text-align: center;
}

.mobile-header-subtitle {
    font-size: var(--font-sm);
    opacity: 0.9;
    text-align: center;
    margin: var(--spacing-xs) 0 0;
}

/* ========================================
   4. 底部导航
   ======================================== */
.mobile-nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    border-top: 1px solid #e0e0e0;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    margin: 0;
    list-style: none;
}

.mobile-nav-item {
    flex: 1;
    text-align: center;
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    min-height: var(--touch-target-size);
    color: #6c757d;
    text-decoration: none;
    transition: all var(--transition-speed) var(--transition-ease);
    position: relative;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
    color: var(--mobile-primary);
    background-color: rgba(0, 123, 255, 0.05);
}

.mobile-nav-link.active {
    color: var(--mobile-primary);
}

.mobile-nav-link.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--mobile-primary);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.mobile-nav-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.mobile-nav-label {
    font-size: var(--font-xs);
    font-weight: 500;
}

/* ========================================
   5. 表单优化
   ======================================== */
.form-mobile {
    width: 100%;
}

.form-group-mobile {
    margin-bottom: var(--spacing-base);
}

.form-label-mobile {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-base);
    font-weight: 500;
    color: #495057;
}

.form-label-mobile.required::after {
    content: ' *';
    color: var(--mobile-danger);
}

.form-control-mobile {
    width: 100%;
    min-height: var(--touch-target-size);
    padding: var(--spacing-md) var(--spacing-base);
    font-size: var(--font-base);
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 2px solid #ced4da;
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control-mobile:focus {
    outline: none;
    border-color: var(--mobile-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-control-mobile::placeholder {
    color: #adb5bd;
    opacity: 1;
}

/* 带图标的输入框 */
.input-group-mobile {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group-mobile .input-icon {
    position: absolute;
    left: var(--spacing-base);
    color: #6c757d;
    font-size: var(--font-lg);
    pointer-events: none;
    z-index: 5;
}

.input-group-mobile .form-control-mobile {
    padding-left: 45px;
}

.input-group-mobile .input-action {
    position: absolute;
    right: var(--spacing-base);
    background: none;
    border: none;
    color: #6c757d;
    font-size: var(--font-lg);
    cursor: pointer;
    padding: var(--spacing-sm);
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
}

/* Select下拉框 */
select.form-control-mobile {
    background-image: 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='%23333' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

/* Textarea */
textarea.form-control-mobile {
    min-height: 100px;
    resize: vertical;
}

/* Checkbox & Radio */
.form-check-mobile {
    display: flex;
    align-items: center;
    min-height: var(--touch-target-min);
    padding-left: 0;
    margin-bottom: var(--spacing-sm);
}

.form-check-mobile input[type="checkbox"],
.form-check-mobile input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: var(--spacing-sm);
    cursor: pointer;
}

.form-check-mobile label {
    margin: 0;
    cursor: pointer;
    font-size: var(--font-base);
    user-select: none;
}

/* ========================================
   6. 渐变按钮
   ======================================== */
.btn-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-target-size);
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-base);
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-speed) var(--transition-ease);
    position: relative;
    overflow: hidden;
}

.btn-mobile:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.btn-mobile:active {
    transform: scale(0.98);
}

.btn-mobile:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* 主要按钮 - 渐变 */
.btn-primary-mobile {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-button);
}

.btn-primary-mobile:hover {
    opacity: 0.9;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* 成功按钮 */
.btn-success-mobile {
    background: var(--gradient-success);
    color: white;
}

/* 危险按钮 */
.btn-danger-mobile {
    background: var(--gradient-danger);
    color: white;
}

/* 轮廓按钮 */
.btn-outline-mobile {
    background: transparent;
    color: var(--mobile-primary);
    border: 2px solid var(--mobile-primary);
}

.btn-outline-mobile:hover {
    background: var(--mobile-primary);
    color: white;
}

/* 按钮尺寸 */
.btn-mobile-sm {
    min-height: 36px;
    padding: var(--spacing-sm) var(--spacing-base);
    font-size: var(--font-sm);
}

.btn-mobile-lg {
    min-height: 56px;
    padding: var(--spacing-base) var(--spacing-2xl);
    font-size: var(--font-lg);
}

.btn-mobile-block {
    width: 100%;
    display: flex;
}

/* FAB浮动按钮 */
.fab-mobile {
    position: fixed;
    right: var(--spacing-base);
    bottom: calc(80px + var(--spacing-base)); /* 底部导航上方 */
    width: 56px;
    height: 56px;
    border-radius: var(--radius-round);
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: var(--z-fixed);
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed) var(--transition-ease);
}

.fab-mobile:hover {
    transform: scale(1.1) rotate(90deg);
}

.fab-mobile:active {
    transform: scale(0.95);
}

/* 加载状态 */
.btn-mobile.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-mobile.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   7. 卡片组件
   ======================================== */
.card-mobile {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-base);
    overflow: hidden;
    transition: box-shadow var(--transition-speed) var(--transition-ease);
}

.card-mobile:hover {
    box-shadow: var(--shadow-md);
}

.card-mobile-header {
    padding: var(--spacing-base);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
}

.card-mobile-header h3 {
    margin: 0;
    font-size: var(--font-lg);
    font-weight: 600;
}

.card-mobile-body {
    padding: var(--spacing-base);
}

.card-mobile-footer {
    padding: var(--spacing-base);
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* KPI卡片 */
.kpi-card {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--spacing-base);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border-left: 4px solid var(--mobile-primary);
}

.kpi-card-value {
    font-size: var(--font-3xl);
    font-weight: 700;
    color: var(--mobile-primary);
    margin: var(--spacing-sm) 0;
}

.kpi-card-label {
    font-size: var(--font-sm);
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-card-icon {
    font-size: 36px;
    opacity: 0.2;
    position: absolute;
    right: var(--spacing-base);
    top: 50%;
    transform: translateY(-50%);
}

/* 酒瓶卡片 */
.bottle-card {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--spacing-base);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-base);
    position: relative;
}

.bottle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--spacing-md);
}

.bottle-card-title {
    font-size: var(--font-lg);
    font-weight: 600;
    margin: 0;
    color: #333;
}

.bottle-card-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.bottle-card-meta-item {
    font-size: var(--font-sm);
}

.bottle-card-meta-label {
    color: #6c757d;
    display: block;
    margin-bottom: 2px;
}

.bottle-card-meta-value {
    color: #333;
    font-weight: 500;
}

.bottle-card-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid #e9ecef;
}

/* ========================================
   8. 表格响应式
   ======================================== */
.table-responsive-mobile {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-mobile {
    width: 100%;
    margin-bottom: var(--spacing-base);
    background-color: white;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.table-mobile thead {
    background-color: #f8f9fa;
}

.table-mobile th {
    padding: var(--spacing-md);
    font-size: var(--font-sm);
    font-weight: 600;
    text-align: left;
    color: #495057;
    white-space: nowrap;
}

.table-mobile td {
    padding: var(--spacing-md);
    font-size: var(--font-sm);
    border-top: 1px solid #dee2e6;
}

/* 移动端表格卡片视图 */
@media (max-width: 768px) {
    .table-mobile-card {
        display: block;
    }
    
    .table-mobile-card thead {
        display: none;
    }
    
    .table-mobile-card tbody {
        display: block;
    }
    
    .table-mobile-card tr {
        display: block;
        background: white;
        border-radius: var(--radius-sm);
        padding: var(--spacing-base);
        margin-bottom: var(--spacing-base);
        box-shadow: var(--shadow-sm);
    }
    
    .table-mobile-card td {
        display: flex;
        justify-content: space-between;
        padding: var(--spacing-sm) 0;
        border: none;
    }
    
    .table-mobile-card td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        margin-right: var(--spacing-base);
    }
}

/* ========================================
   9. 徽章系统
   ======================================== */
.badge-mobile {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: var(--font-xs);
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-round);
    white-space: nowrap;
}

/* 状态徽章 */
.badge-status {
    padding: 6px 12px;
    font-size: var(--font-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-stored {
    background-color: #d4edda;
    color: #155724;
}

.status-retrieved {
    background-color: #cce5ff;
    color: #004085;
}

/* VIP等级徽章 */
.badge-vip {
    padding: 6px 12px;
    font-size: var(--font-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.vip-normal {
    background-color: #e9ecef;
    color: #495057;
}

.vip-silver {
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
    color: white;
}

.vip-gold {
    background: linear-gradient(135deg, #f7b733 0%, #fc4a1a 100%);
    color: white;
}

.vip-diamond {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ========================================
   10. 提示框 (Toast/Alert)
   ======================================== */
.alert-mobile {
    padding: var(--spacing-base);
    margin-bottom: var(--spacing-base);
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    animation: slideInDown 0.3s ease;
}

.alert-success {
    background-color: #d4edda;
    border-color: var(--mobile-success);
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: var(--mobile-danger);
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: var(--mobile-warning);
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: var(--mobile-info);
    color: #0c5460;
}

/* Toast通知 */
.toast-mobile {
    position: fixed;
    top: var(--spacing-base);
    right: var(--spacing-base);
    left: var(--spacing-base);
    z-index: var(--z-tooltip);
    padding: var(--spacing-base);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ========================================
   11. 模态框
   ======================================== */
.modal-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-modal);
    overflow: hidden;
}

.modal-mobile.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.modal-content-mobile {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideInUp 0.3s ease;
    z-index: 2;
}

.modal-header-mobile {
    padding: var(--spacing-base);
    background: var(--gradient-primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title-mobile {
    margin: 0;
    font-size: var(--font-xl);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body-mobile {
    padding: var(--spacing-base);
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer-mobile {
    padding: var(--spacing-base);
    background-color: #f8f9fa;
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

/* 底部弹出模态框 */
.modal-bottom {
    align-items: flex-end;
}

.modal-bottom .modal-content-mobile {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ========================================
   12. 分页
   ======================================== */
.pagination-mobile {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    margin: var(--spacing-base) 0;
    padding: 0;
    list-style: none;
}

.page-item {
    margin: 0;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    padding: var(--spacing-sm);
    color: var(--mobile-primary);
    text-decoration: none;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-sm);
    transition: all var(--transition-speed) var(--transition-ease);
}

.page-link:hover {
    background-color: var(--mobile-primary-light);
    border-color: var(--mobile-primary);
}

.page-item.active .page-link {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.page-item.disabled .page-link {
    opacity: 0.5;
    pointer-events: none;
}

/* ========================================
   13. 加载状态
   ======================================== */
/* Spinner */
.spinner-mobile {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 123, 255, 0.1);
    border-top-color: var(--mobile-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 16px;
    margin-bottom: var(--spacing-sm);
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: var(--spacing-base);
}

.skeleton-card {
    height: 120px;
    margin-bottom: var(--spacing-base);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Progress Bar */
.progress-mobile {
    height: 8px;
    background-color: #e9ecef;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar-mobile {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

/* ========================================
   14. 工具类
   ======================================== */
/* 间距工具类 */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: var(--spacing-xs) !important; }
.mt-2 { margin-top: var(--spacing-sm) !important; }
.mt-3 { margin-top: var(--spacing-md) !important; }
.mt-4 { margin-top: var(--spacing-base) !important; }
.mb-1 { margin-bottom: var(--spacing-xs) !important; }
.mb-2 { margin-bottom: var(--spacing-sm) !important; }
.mb-3 { margin-bottom: var(--spacing-md) !important; }
.mb-4 { margin-bottom: var(--spacing-base) !important; }

.p-0 { padding: 0 !important; }
.pt-1 { padding-top: var(--spacing-xs) !important; }
.pt-2 { padding-top: var(--spacing-sm) !important; }
.pt-3 { padding-top: var(--spacing-md) !important; }
.pt-4 { padding-top: var(--spacing-base) !important; }
.pb-1 { padding-bottom: var(--spacing-xs) !important; }
.pb-2 { padding-bottom: var(--spacing-sm) !important; }
.pb-3 { padding-bottom: var(--spacing-md) !important; }
.pb-4 { padding-bottom: var(--spacing-base) !important; }

/* 文本工具类 */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-muted { color: #6c757d !important; }
.text-primary { color: var(--mobile-primary) !important; }
.text-success { color: var(--mobile-success) !important; }
.text-danger { color: var(--mobile-danger) !important; }
.text-warning { color: var(--mobile-warning) !important; }

.font-weight-normal { font-weight: 400 !important; }
.font-weight-bold { font-weight: 600 !important; }
.font-size-sm { font-size: var(--font-sm) !important; }
.font-size-lg { font-size: var(--font-lg) !important; }

/* 显示工具类 */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }

.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }

/* 响应式显示 */
@media (max-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
}

@media (min-width: 577px) {
    .d-sm-only { display: none !important; }
}

@media (max-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
}

@media (min-width: 769px) {
    .d-md-only { display: none !important; }
}

/* 宽度工具类 */
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }

/* 阴影工具类 */
.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* 圆角工具类 */
.rounded { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-circle { border-radius: 50% !important; }

/* ========================================
   15. 无障碍 (Accessibility)
   ======================================== */
/* Focus状态 */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--mobile-primary);
    outline-offset: 2px;
}

/* 跳转到主内容 */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--mobile-primary);
    color: white;
    padding: var(--spacing-sm) var(--spacing-base);
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* 屏幕阅读器专用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   16. 打印样式
   ======================================== */
@media print {
    .mobile-nav-bottom,
    .mobile-header,
    .fab-mobile,
    .btn-mobile,
    .no-print {
        display: none !important;
    }
    
    .mobile-content {
        padding-bottom: 0;
    }
    
    .card-mobile,
    .bottle-card {
        box-shadow: none;
        border: 1px solid #dee2e6;
        page-break-inside: avoid;
    }
}

/* ========================================
   17. 深色模式准备
   ======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --mobile-dark: #f8f9fa;
        --mobile-light: #343a40;
    }
    
    /* 如果需要深色模式,取消下面注释 */
    /*
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .card-mobile,
    .bottle-card,
    .form-control-mobile {
        background-color: #2d2d2d;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .mobile-nav-bottom {
        background-color: #2d2d2d;
        border-top-color: #444;
    }
    */
}

/* ========================================
   18. 页面特定样式
   ======================================== */
/* 登录页面 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-base);
    background: var(--gradient-primary);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-base);
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: var(--shadow-md);
}

.login-title {
    text-align: center;
    font-size: var(--font-2xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: #333;
}

.login-subtitle {
    text-align: center;
    color: #6c757d;
    font-size: var(--font-sm);
    margin-bottom: var(--spacing-xl);
}

/* 仪表盘布局 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-base);
    margin-bottom: var(--spacing-base);
}

@media (max-width: 576px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 列表筛选栏 */
.filter-bar {
    background: white;
    padding: var(--spacing-base);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-base);
    box-shadow: var(--shadow-sm);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
}

@media (max-width: 576px) {
    .filter-row {
        grid-template-columns: 1fr;
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: #6c757d;
}

.empty-state-icon {
    font-size: 64px;
    opacity: 0.5;
    margin-bottom: var(--spacing-base);
}

.empty-state-title {
    font-size: var(--font-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.empty-state-text {
    font-size: var(--font-base);
    margin-bottom: var(--spacing-base);
}

/* ========================================
   19. 动画库扩展
   ======================================== */
.animate-fadeIn { animation: fadeIn 0.3s ease; }
.animate-fadeInUp { animation: fadeInUp 0.3s ease; }
.animate-fadeInDown { animation: fadeInDown 0.3s ease; }
.animate-slideInUp { animation: slideInUp 0.3s ease; }
.animate-slideInDown { animation: slideInDown 0.3s ease; }
.animate-shake { animation: shake 0.5s ease; }
.animate-pulse { animation: pulse 0.5s ease; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   20. 滑动操作
   ======================================== */
.swipe-item {
    position: relative;
    overflow: hidden;
}

.swipe-content {
    position: relative;
    z-index: 2;
    background: white;
    transition: transform 0.3s ease;
}

.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    z-index: 1;
}

.swipe-action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--spacing-base);
    color: white;
    min-width: 80px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.swipe-action-delete {
    background-color: var(--mobile-danger);
}

.swipe-action-edit {
    background-color: var(--mobile-primary);
}

/* ========================================
   完成 - 移动端优化CSS框架 v2.0
   总计约 850+ 行代码
   ======================================== */
