/* style.css - 智能工厂用电量管理系统样式 */

:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow: 0 10px 30px rgba(0,0,0,0.1);
    --radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* 头部样式 */
header {
    background: var(--gradient);
    color: white;
    padding: 25px 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-20px, -20px) rotate(360deg); }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.logo {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.logo-icon i {
    font-size: 2rem;
    color: white;
}

.logo-text h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.logo-text p {
    opacity: 0.9;
    font-size: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255,255,255,0.15);
    padding: 12px 20px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.user-details {
    text-align: right;
}

.user-role {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 3px;
}

.user-name {
    font-weight: 600;
    font-size: 1.1rem;
}

/* 标签页样式 */
.tabs-container {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow: hidden;
}

.tabs {
    display: flex;
    background: white;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 20px 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    flex: 1;
    min-width: 140px;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 3px solid transparent;
    position: relative;
    white-space: nowrap;
}

.tab.active {
    color: var(--secondary);
    border-bottom-color: var(--secondary);
    background: linear-gradient(to bottom, rgba(52, 152, 219, 0.05), transparent);
}

.tab:not(.active):hover {
    background: rgba(52, 152, 219, 0.05);
    color: var(--secondary);
}

.tab i {
    margin-right: 8px;
    font-size: 1.1rem;
}

/* 内容区域样式 */
.tab-content {
    display: none;
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease;
}

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

.tab-content.active {
    display: block;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--dark);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light);
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title i {
    color: var(--secondary);
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.card h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h3 i {
    color: var(--secondary);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.9;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 15px 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 500;
}

/* 表单样式 */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark);
    font-size: 1.1rem;
}

input, select, textarea {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--secondary);
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    outline: none;
}

/* 按钮样式 */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), #2980b9);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #219a52);
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #c0392b);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #e67e22);
    color: white;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th, td {
    padding: 18px 20px;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
}

th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

tr:hover {
    background: #f8f9fa;
}

/* 操作按钮 */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.edit-btn {
    background: var(--warning);
    color: white;
}

.delete-btn {
    background: var(--danger);
    color: white;
}

/* 权限提示 */
.permission-note {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border-left: 4px solid var(--warning);
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.permission-note i {
    color: var(--warning);
    font-size: 1.5rem;
}

/* 登录模态框 */
.login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.login-form {
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.login-title {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--dark);
}

.login-subtitle {
    color: #7f8c8d;
    margin-bottom: 30px;
}

.role-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.role-btn {
    flex: 1;
    padding: 15px;
    text-align: center;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.role-btn.active {
    border-color: var(--secondary);
    background: rgba(52, 152, 219, 0.1);
    color: var(--secondary);
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.badge-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.badge-success {
    background: linear-gradient(135deg, #27ae60, #219a52);
    color: white;
}

.badge-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .logo {
        flex-direction: column;
        gap: 15px;
    }
    
    .logo-text h1 {
        font-size: 1.8rem;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
    }
    
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    
    .tab {
        min-width: 120px;
        padding: 15px 20px;
        font-size: 0.9rem;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 25px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    th, td {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .tab {
        min-width: 100px;
        padding: 12px 15px;
        font-size: 0.8rem;
    }
    
    .login-form {
        padding: 30px 20px;
    }
    
    .role-selector {
        flex-direction: column;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 日期选择器样式 */
.date-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    align-items: end;
    flex-wrap: wrap;
}

.date-group {
    flex: 1;
    min-width: 200px;
}

/* 币种选择器 */
.currency-selector {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.currency-flag {
    width: 24px;
    height: 18px;
    border-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* 页脚 */
.footer {
    text-align: center;
    margin-top: 50px;
    padding: 30px;
    color: #7f8c8d;
    font-size: 0.9rem;
    border-top: 1px solid #e1e8ed;
}

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

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #bdc3c7;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #95a5a6;
}

/* 提示消息动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 数据概览头部布局 */
.section-header {
    display: flex;
    display: -webkit-flex;
    justify-content: space-between;
    -webkit-justify-content: space-between;
    align-items: center;
    -webkit-align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    -webkit-flex-wrap: wrap;
}

.section-header > * {
    margin: 5px 0;
}

.section-title {
    margin: 0;
    display: flex;
    display: -webkit-flex;
    align-items: center;
    -webkit-align-items: center;
}

.section-title i {
    margin-right: 10px;
}

.header-actions {
    display: flex;
    display: -webkit-flex;
}

/* 返回ERP主页按钮样式 */
.btn-info {
    background: #17a2b8;
    background: -webkit-linear-gradient(135deg, #17a2b8, #138496);
    background: linear-gradient(135deg, #17a2b8, #138496);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    display: -webkit-inline-flex;
    align-items: center;
    -webkit-align-items: center;
    font-weight: 500;
    transition: all 0.3s ease;
    -webkit-transition: all 0.3s ease;
}

.btn-info i {
    margin-right: 8px;
}

.btn-info:hover {
    background: #138496;
    background: -webkit-linear-gradient(135deg, #138496, #117a8b);
    background: linear-gradient(135deg, #138496, #117a8b);
    transform: translateY(-2px);
    -webkit-transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
    -webkit-box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
    color: white;
    text-decoration: none;
}

/* 确保统计网格只有3个卡片 - 使用flexbox兼容方案 */
.stats-grid {
    display: flex;
    display: -webkit-flex;
    flex-wrap: wrap;
    -webkit-flex-wrap: wrap;
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    flex: 1;
    -webkit-flex: 1;
    min-width: 200px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        -webkit-flex-direction: column;
        align-items: flex-start;
        -webkit-align-items: flex-start;
    }
    
    .stats-grid {
        flex-direction: column;
        -webkit-flex-direction: column;
    }
    
    .stat-card {
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
        -webkit-justify-content: flex-start;
    }
}
