/* 管理后台美化样式 - 默认主题 */

/* 全局样式 */
:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --sidebar-bg: #4e73df;
    --sidebar-hover: #2e59d9;
    --card-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    --border-radius: 0.5rem;
    --transition: all 0.3s ease;
}

/* 圣诞节主题变量 */
.christmas-theme {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-bg: #0f5132;
    --sidebar-hover: #0a3622;
    --card-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.15);
    --border-radius: 0.5rem;
    --transition: all 0.3s ease;
}

/* 基础样式重置 */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    transition: var(--transition);
}

/* 导航栏样式 */
.navbar {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    transition: var(--transition);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: white !important;
    display: flex;
    align-items: center;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

.nav-link {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8) !important;
    transition: var(--transition);
    border-radius: var(--border-radius);
    margin: 0 0.25rem;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover, .nav-link.active {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
}

/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    background: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

/* 主内容区域 */
.main-content {
    padding: 1.5rem;
    transition: var(--transition);
}

/* 页面标题 */
.page-title {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title h1 {
    margin: 0;
    font-size: 1.75rem;
}

.page-title .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

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

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: var(--dark-color);
}

.card-body {
    padding: 1.25rem;
}

/* 统计卡片 */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary-color);
}

.stat-card.primary::before {
    background-color: var(--primary-color);
}

.stat-card.success::before {
    background-color: var(--success-color);
}

.stat-card.info::before {
    background-color: var(--info-color);
}

.stat-card.warning::before {
    background-color: var(--warning-color);
}

.stat-card .card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card .stat-info {
    flex: 1;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--secondary-color);
    text-transform: uppercase;
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-card.primary .stat-icon {
    background-color: var(--primary-color);
}

.stat-card.success .stat-icon {
    background-color: var(--success-color);
}

.stat-card.info .stat-icon {
    background-color: var(--info-color);
}

.stat-card.warning .stat-icon {
    background-color: var(--warning-color);
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--dark-color);
    background-color: var(--light-color);
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.table td {
    font-size: 0.875rem;
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* 按钮样式 */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-success {
    background-color: var(--success-color);
}

.btn-info {
    background-color: var(--info-color);
}

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

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* 表单样式 */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

/* 图片上传区域样式 */
.upload-area {
    position: relative;
    overflow: hidden;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background-color: var(--light-bg);
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
    transform: scale(1.02);
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.upload-overlay {
    pointer-events: none;
}

.upload-content {
    color: var(--text-muted);
}

.upload-content p {
    margin-bottom: 0;
}

/* 图片预览样式 */
.preview-container {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--light-bg);
}

.preview-container img {
    display: block;
    max-height: 400px;
    margin: 0 auto;
}

.preview-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preview-container:hover .preview-actions {
    opacity: 1;
}

/* 处理步骤样式 */
.process-steps {
    position: relative;
    padding-left: 30px;
}

.step-item {
    position: relative;
    padding-bottom: 20px;
    padding-left: 20px;
}

.step-item:not(:last-child):before {
    content: '';
    position: absolute;
    top: 24px;
    left: 9px;
    height: calc(100% - 4px);
    width: 2px;
    background-color: var(--border-color);
}

.step-number {
    position: absolute;
    left: -30px;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.step-text {
    color: var(--text-color);
    font-size: 14px;
}

/* 圣诞节主题特殊样式 */
.christmas-theme .upload-area {
    border-color: #c41e3a;
    background-color: rgba(196, 30, 58, 0.05);
}

.christmas-theme .upload-area:hover {
    border-color: #165b33;
    background-color: rgba(22, 91, 51, 0.05);
}

.christmas-theme .upload-area.drag-over {
    border-color: #ffd700;
    background-color: rgba(255, 215, 0, 0.1);
}

.christmas-theme .step-number {
    background-color: #c41e3a;
}

.christmas-theme .step-item:not(:last-child):before {
    background-color: #165b33;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .upload-area {
        padding: 30px 15px;
    }
    
    .preview-container img {
        max-height: 250px;
    }
}

/* 预警框样式 */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* 徽章样式 */
.badge {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
}

/* 分页样式 */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border: none;
    color: var(--primary-color);
    padding: 0.5rem 0.75rem;
    margin: 0 0.125rem;
    border-radius: var(--border-radius);
}

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

/* 圣诞节主题特殊样式 */
.christmas-theme {
    background-color: #f8f9fa;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23dc3545' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.christmas-theme .navbar {
    background: linear-gradient(to right, #0f5132, #198754) !important;
    position: relative;
}

.christmas-theme .navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: repeating-linear-gradient(
        90deg,
        #dc3545,
        #dc3545 10px,
        #ffc107 10px,
        #ffc107 20px,
        #198754 20px,
        #198754 30px
    );
}

.christmas-theme .theme-toggle {
    background: #f8f9fa;
    border: 2px solid #dc3545;
}

.christmas-theme .theme-toggle i {
    color: #dc3545;
}

.christmas-theme .card {
    border-top: 3px solid #198754;
    position: relative;
    overflow: hidden;
}

.christmas-theme .card::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23dc3545'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.7;
}

.christmas-theme .stat-card::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23198754'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z'/%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.7;
}

.christmas-theme .navbar-brand::before {
    content: '🎄 ';
    margin-right: 0.5rem;
}

.christmas-theme .btn-primary {
    background-color: #0f5132;
    border-color: #0f5132;
}

.christmas-theme .btn-primary:hover {
    background-color: #0a3622;
    border-color: #0a3622;
}

.christmas-theme .btn-success {
    background-color: #198754;
    border-color: #198754;
}

.christmas-theme .btn-success:hover {
    background-color: #146c43;
    border-color: #146c43;
}

.christmas-theme .btn-info {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

.christmas-theme .btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}

.christmas-theme .btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.christmas-theme .page-link {
    color: #0f5132;
}

.christmas-theme .page-item.active .page-link {
    background-color: #0f5132;
    border-color: #0f5132;
}

.christmas-theme .table thead th {
    background-color: #f8f9fa;
    color: #0f5132;
    border-bottom: 2px solid #198754;
}

.christmas-theme .badge.bg-primary {
    background-color: #0f5132 !important;
}

.christmas-theme .badge.bg-success {
    background-color: #198754 !important;
}

.christmas-theme .badge.bg-info {
    background-color: #0dcaf0 !important;
    color: #000 !important;
}

.christmas-theme .badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.christmas-theme .badge.bg-danger {
    background-color: #dc3545 !important;
}

/* 雪花效果 */
.snowflake {
    position: fixed;
    top: -10px;
    z-index: 9999;
    user-select: none;
    cursor: default;
    animation: snowfall linear infinite;
    color: #fff;
    font-size: 1em;
    opacity: 0.8;
}

@keyframes snowfall {
    0% {
        transform: translateY(-100px);
    }
    100% {
        transform: translateY(calc(100vh + 100px));
    }
}

/* 圣诞装饰横幅 */
.christmas-decorations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: repeating-linear-gradient(
        90deg,
        #dc3545,
        #dc3545 10px,
        #ffc107 10px,
        #ffc107 20px,
        #198754 20px,
        #198754 30px
    );
    z-index: 10;
}

/* 圣诞帽 */
.christmas-hat {
    display: inline-block;
    font-size: 1.2em;
    margin-left: 5px;
    animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .stat-card .card-body {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-card .stat-icon {
        margin-top: 1rem;
    }
    
    .page-title {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-title .breadcrumb {
        margin-top: 0.5rem;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .theme-toggle {
        top: auto;
        bottom: 20px;
        right: 20px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* 状态指示器 */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-online {
    background-color: var(--success-color);
}

.status-offline {
    background-color: var(--danger-color);
}

.status-disabled {
    background-color: var(--secondary-color);
}

/* 设备卡片样式 */
.device-card {
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.device-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* 内容卡片样式 */
.content-card {
    transition: var(--transition);
    border-left: 4px solid var(--info-color);
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* 时间线样式 */
.timeline {
    position: relative;
    padding: 0;
    list-style: none;
}

.timeline:before {
    content: '';
    position: absolute;
    top: 0;
    left: 30px;
    height: 100%;
    width: 2px;
    background: rgba(0, 0, 0, 0.1);
}

.timeline-item {
    margin-bottom: 1.5rem;
    position: relative;
}

.timeline-item:before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid white;
    z-index: 1;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-color);
}