* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    background-attachment: fixed;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
}

.page {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    background: #f5f5f5;
}

.page.active {
    display: block;
    position: relative;
}

/* 导航栏 */
.navbar {
    background: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.nav-user span {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-link {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    text-decoration: underline;
}

/* 内容页面 */
.content-page {
    display: none;
    width: 100%;
    min-height: calc(100vh - 60px);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    background: #fff;
    position: relative;
}

/* 专注页面特殊样式 - 占满整个页面 */
#focus-page {
    background: #000 !important;
    height: calc(100vh - 60px) !important;
    max-height: calc(100vh - 60px) !important;
    overflow: hidden !important;
    padding-bottom: 0 !important;
}

/* 底部导航栏高度调整 */
.toolbar-bottom {
    height: 60px !important;
    min-height: 60px;
}

/* 首页特殊样式 */
#home-page {
    background: #fff;
}

/* 个人中心特殊样式 */
#profile-page {
    background: #f5f5f5;
}

/* Framework7 Row和Column布局修复 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    width: 100%;
}

.col-25 {
    width: 25%;
    flex: 0 0 25%;
    box-sizing: border-box;
}

.col-33 {
    width: 33.333%;
    flex: 0 0 33.333%;
    box-sizing: border-box;
}

.col-50 {
    width: 50%;
    flex: 0 0 50%;
    box-sizing: border-box;
}

/* 确保统计信息在同一行 */
.stats-row {
    display: flex !important;
    align-items: center;
    justify-content: space-around;
    width: 100%;
}

.stats-row > div {
    flex: 1;
    text-align: center;
}

.content-page.active {
    display: block;
    min-height: calc(100vh - 60px - 60px);
}

.page-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
}

h2 {
    margin-bottom: 16px;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card h3 {
    margin-bottom: 12px;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-item {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.card-item > div:first-child {
    flex: 1;
    min-width: 0;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px; /* 防止iOS自动缩放 */
    -webkit-appearance: none;
    appearance: none;
}

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

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    cursor: pointer;
}

/* 按钮 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px; /* 触摸友好 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: #007bff;
    color: #fff;
}

.btn-primary:active {
    background: #0056b3;
    transform: scale(0.98);
}

.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-success:active {
    background: #218838;
    transform: scale(0.98);
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:active {
    background: #c82333;
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

/* Framework7覆盖样式 */
.page-content {
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
}

/* 专注页面特殊样式 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        text-shadow: 0 0 30px rgba(255,255,255,0.3), 0 0 60px rgba(102, 126, 234, 0.5);
    }
    50% {
        opacity: 0.95;
        transform: scale(1.01);
        text-shadow: 0 0 40px rgba(255,255,255,0.4), 0 0 80px rgba(102, 126, 234, 0.6);
    }
}

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

/* 现代化卡片样式 */
.card {
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:active {
    transform: scale(0.98);
}

.card-outline {
    border: 1px solid rgba(0,0,0,0.1);
}

/* 按钮现代化样式 */
.button {
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.button:active {
    transform: scale(0.96);
}

.button-fill {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 列表项现代化 */
.list ul {
    background: transparent;
}

.item-content {
    border-radius: 12px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.item-content:active {
    background: rgba(0,0,0,0.05);
}

/* 导航栏现代化 */
.navbar {
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* 底部导航现代化 */
.toolbar {
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.tab-link {
    transition: all 0.2s;
    border-radius: 12px 12px 0 0;
}

.tab-link-active {
    background: rgba(0, 123, 255, 0.1);
}

/* 输入框现代化 */
.item-input input,
.item-input select {
    border-radius: 8px;
    transition: all 0.2s;
}

.item-input input:focus,
.item-input select:focus {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background-color: #fff;
    margin: 20px auto;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 500px;
    position: relative;
    min-height: calc(100vh - 40px);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

.close {
    position: absolute;
    right: 16px;
    top: 16px;
    font-size: 32px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.close:active {
    color: #000;
    transform: scale(0.9);
}

/* 消息提示 */
.message {
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 4px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 首页样式 */
.welcome-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.welcome-card h2 {
    color: #fff;
    margin-bottom: 24px;
    font-size: 24px;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    width: 100%;
}

.stat-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #fff;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    color: #fff;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    min-height: 52px;
}

/* 专注页面特殊样式 */
.focus-container {
    background: #000;
    color: #fff;
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.focus-controls {
    margin: 30px 0;
    display: flex;
    gap: 16px;
    justify-content: center;
}

.focus-controls .btn {
    min-width: 120px;
}

.timer {
    font-size: 72px;
    font-weight: 300;
    letter-spacing: 4px;
    margin-bottom: 30px;
    animation: pulse 1s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

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

.status {
    font-size: 18px;
    color: #888;
    margin-bottom: 20px;
}

.status.active {
    color: #4CAF50;
}

.status.paused {
    color: #ff9800;
}

.stats {
    margin-top: 40px;
    font-size: 16px;
    color: #666;
}

.stats-item {
    margin: 10px 0;
}

/* 移动端优化 */
@media (max-width: 480px) {
    .timer {
        font-size: 64px;
        letter-spacing: 4px;
    }
    
    .page-container {
        padding: 12px;
    }
    
    .card {
        padding: 16px;
        margin-bottom: 12px;
        border-radius: 16px;
    }
    
    .card-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        border-radius: 12px;
    }
    
    .card-item > div:last-child {
        width: 100%;
        display: flex;
        gap: 8px;
        margin-top: 8px;
    }
    
    .card-item .btn {
        flex: 1;
        font-size: 14px;
        padding: 10px 16px;
        border-radius: 8px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    .navbar {
        padding: 10px 12px;
    }
    
    .nav-brand {
        font-size: 16px;
    }
    
    .modal-content {
        margin: 0;
        border-radius: 16px 16px 0 0;
        padding: 16px;
    }
    
    .display-2 {
        font-size: 28px;
    }
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state::before {
    content: '📭';
    display: block;
    font-size: 48px;
    margin-bottom: 15px;
}

