/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1890ff;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #f5222d;
    --text-color: #333;
    --text-secondary: #666;
    --border-color: #e8e8e8;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --header-height: 60px;
    --sidebar-width: 250px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 主容器 */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部导航栏 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: var(--text-color);
}

.title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background: var(--danger-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.user-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 侧边菜单 */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: -100%;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    transition: left 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 48px;
    margin-bottom: 10px;
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.menu {
    list-style: none;
    padding: 10px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-color);
}

.menu-item:hover {
    background: var(--bg-color);
}

.menu-item.active {
    background: var(--primary-color);
    color: #fff;
}

.menu-item .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

/* 主内容区 */
.main-content {
    margin-top: var(--header-height);
    padding: 20px;
    min-height: calc(100vh - var(--header-height));
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-title {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-color);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 50%;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.stat-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 区块 */
.section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

/* 报警列表 */
.alarm-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alarm-item {
    background: var(--bg-color);
    border-left: 4px solid var(--warning-color);
    border-radius: 4px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.alarm-item:hover {
    background: #e8f4ff;
    transform: translateX(5px);
}

.alarm-item.danger {
    border-left-color: var(--danger-color);
}

.alarm-item.success {
    border-left-color: var(--success-color);
}

.alarm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.alarm-title {
    font-weight: 600;
    font-size: 16px;
}

.alarm-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.alarm-content {
    font-size: 14px;
    color: var(--text-secondary);
}

.alarm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--warning-color);
    color: #fff;
    margin-top: 5px;
}

/* 信息卡片 */
.info-card {
    background: var(--bg-color);
    border-radius: 4px;
    padding: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    color: var(--text-secondary);
    font-size: 14px;
}

.info-row .value {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
}

/* 虾场卡片 */
.farm-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.farm-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.farm-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.farm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.farm-name {
    font-size: 18px;
    font-weight: 600;
}

.farm-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
}

.farm-status.offline {
    background: var(--danger-color);
}

.farm-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.farm-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.farm-stat {
    text-align: center;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 4px;
}

.farm-stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.farm-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

/* 设置页面 */
.settings-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.settings-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

/* 开关按钮 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.about-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 10px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* 响应式设计 - 平板 */
@media (min-width: 768px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
    
    .sidebar {
        left: 0;
    }
    
    .menu-btn {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 响应式设计 - 桌面 */
@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 767px) {
    .header {
        padding: 0 15px;
    }
    
    .title {
        font-size: 16px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .farm-list {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
}


/* 弹窗样式 */
.modal {
    display: flex;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

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

.modal-content {
    background-color: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 28px;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 16px;
    color: #666;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.detail-item .label {
    color: #666;
    font-size: 14px;
}

.detail-item .value {
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.detail-item .value.success {
    color: #28a745;
}

.detail-item .value.error {
    color: #dc3545;
}

.update-time {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 10px;
}

/* 手机端优化 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}
