/* CUST宿舍实时温度监控系统样式 */

:root {
    --primary-color: #0d6efd;
    --temperature-color: #dc3545;
    --humidity-color: #0dcaf0;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 状态指示器样式 */
.status-indicator {
    padding: 1rem;
}

.status-indicator i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

#connection-icon.connected {
    color: var(--success-color);
}

#connection-icon.disconnected {
    color: var(--danger-color);
}

/* 温度卡片样式 */
.temperature-card {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(238, 90, 36, 0.3);
    transition: transform 0.3s ease;
}

.temperature-card:hover {
    transform: translateY(-5px);
}

.temperature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.temperature-value {
    font-size: 3.5rem;
    font-weight: bold;
    margin: 1rem 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.temperature-trend {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 湿度卡片样式 */
.humidity-card {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.3);
    transition: transform 0.3s ease;
}

.humidity-card:hover {
    transform: translateY(-5px);
}

.humidity-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.humidity-value {
    font-size: 3.5rem;
    font-weight: bold;
    margin: 1rem 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.humidity-trend {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 趋势指示器 */
.trend-up {
    color: #ff6b6b;
}

.trend-down {
    color: #74b9ff;
}

.trend-stable {
    color: #55a3ff;
}

/* 卡片样式增强 */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #e9ecef;
    border-radius: 15px 15px 0 0 !important;
}

/* 按钮样式 */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 徽章样式 */
.badge {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

/* 图表容器 */
#temperatureChart {
    max-height: 400px;
    border-radius: 8px;
}

/* 图表容器在移动端的优化 */
@media (max-width: 768px) {
    #temperatureChart {
        max-height: 280px;
    }
}

@media (max-width: 576px) {
    #temperatureChart {
        max-height: 250px;
    }
}

/* 响应式工具类 */
@media (min-width: 768px) {
    .w-md-auto {
        width: auto !important;
    }

    .text-md-end {
        text-align: right !important;
    }
}

/* 响应式设计 */

/* 大屏幕平板 (768px - 992px) */
@media (max-width: 992px) and (min-width: 769px) {
    .container-fluid {
        padding: 0 2rem;
    }

    .temperature-value,
    .humidity-value {
        font-size: 3rem;
    }

    .card {
        margin-bottom: 2rem;
    }
}

/* 小屏幕平板和大屏手机 (576px - 768px) */
@media (max-width: 768px) and (min-width: 577px) {
    .container-fluid {
        padding: 0 1.5rem;
    }

    /* 平板端左右布局温度湿度卡片优化 */
    .temperature-value,
    .humidity-value {
        font-size: 2.2rem;
        margin: 1.2rem 0;
    }

    .temperature-icon,
    .humidity-icon {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .card {
        margin-bottom: 2rem;
    }

    .card-body {
        padding: 1.8rem 1.2rem;
    }

    .card-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .temperature-trend,
    .humidity-trend {
        font-size: 1rem;
        margin-top: 1rem;
    }

    .status-indicator {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .status-indicator i {
        font-size: 1.8rem;
        margin-bottom: 0.8rem;
    }

    .btn-group .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* 手机屏幕 (最大576px) */
@media (max-width: 576px) {
    .container-fluid {
        padding: 0 1rem;
    }

    /* 头部优化 */
    header {
        padding: 2rem 0 !important;
        margin-bottom: 2rem !important;
    }

    header h1 {
        font-size: 1.8rem;
        line-height: 1.3;
    }

    header p {
        font-size: 0.9rem;
        margin-top: 0.5rem !important;
    }

    /* 卡片间距优化 */
    .card {
        margin-bottom: 2rem;
        border-radius: 12px;
    }

    .card-body {
        padding: 2rem 1.5rem;
    }

    /* 温度湿度卡片优化 */
    .temperature-value,
    .humidity-value {
        font-size: 2.5rem;
        margin: 1.5rem 0;
        line-height: 1.2;
    }

    .temperature-icon,
    .humidity-icon {
        font-size: 2.2rem;
        margin-bottom: 1.2rem;
    }

    .card-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .temperature-trend,
    .humidity-trend {
        font-size: 1rem;
        margin-top: 1rem;
    }

    /* 状态指示器优化 */
    .status-indicator {
        padding: 1.2rem 0.8rem;
        margin-bottom: 1.5rem;
    }

    .status-indicator i {
        font-size: 1.6rem;
        margin-bottom: 0.8rem;
    }

    .status-indicator div {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }

    .badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    /* 按钮组优化 */
    .btn-group {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .btn-group .btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }

    /* 图表区域优化 */
    .card-header {
        padding: 1.5rem;
        flex-direction: column;
        align-items: flex-start !important;
    }

    .card-header h5 {
        margin-bottom: 1rem !important;
        font-size: 1.1rem;
    }

    #temperatureChart {
        max-height: 300px;
    }

    /* 数据刷新区域优化 */
    .row.align-items-center .col-md-6 {
        margin-bottom: 1rem;
        text-align: center;
    }

    .row.align-items-center .col-md-6:last-child {
        text-align: center;
    }

    .form-check {
        justify-content: center;
    }

    /* 统计卡片优化 */
    .text-center .fs-1 {
        font-size: 2.5rem !important;
    }

    .text-center .fs-4 {
        font-size: 1.3rem !important;
    }

    .card-title {
        font-size: 0.95rem;
    }

    /* 页脚优化 */
    footer {
        padding: 2rem 0 !important;
        margin-top: 3rem !important;
    }

    footer p {
        line-height: 1.5;
        margin-bottom: 0.5rem !important;
    }
}

/* 动画效果 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

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

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

/* 数据更新闪烁效果 */
.data-updated {
    animation: flash 0.5s ease-in-out;
}

@keyframes flash {
    0% { background-color: transparent; }
    50% { background-color: rgba(13, 110, 253, 0.2); }
    100% { background-color: transparent; }
}

/* 连接状态样式 */
.status-connected {
    color: var(--success-color);
}

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

.status-connecting {
    color: var(--warning-color);
}

/* 页脚样式 */
footer {
    margin-top: auto;
    border-top: 1px solid #e9ecef;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #0b5ed7;
}

/* 移动端状态指示器专用样式 */
.mobile-status-row {
    margin: 0;
}

/* 状态指示器卡片整体增大 */
@media (max-width: 768px) {
    .mobile-status-row .card-body {
        padding: 1.5rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .mobile-status-row .card-body {
        padding: 1.2rem 0.3rem;
    }
}

@media (max-width: 480px) {
    .mobile-status-row .card-body {
        padding: 1rem 0.2rem;
    }
}

.status-indicator-mobile {
    padding: 1rem 0.3rem;
    border-right: 1px solid rgba(0,0,0,0.1);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease;
}

.status-indicator-mobile:hover {
    background-color: rgba(0,0,0,0.02);
}

.status-indicator-mobile:last-child {
    border-right: none;
}

.status-indicator-mobile i {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    display: block;
    transition: color 0.2s ease;
}

.status-indicator-mobile div {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    font-weight: 500;
    color: #666;
    text-align: center;
}

.status-indicator-mobile .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: all 0.2s ease;
}

/* 连接状态图标颜色 */
.status-indicator-mobile i.connected {
    color: var(--success-color);
}

.status-indicator-mobile i.disconnected {
    color: var(--danger-color);
}

/* 温度湿度卡片左右布局通用优化 */
.temperature-card,
.humidity-card {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* 确保文字在小屏幕上不会换行 */
.temperature-value,
.humidity-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 趋势指示器在左右布局时的优化 */
.temperature-trend,
.humidity-trend {
    min-height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 移动端统计卡片样式 */
.mobile-stats-layout {
    margin: 0 -0.25rem;
}

.mobile-stats-layout .col-6 {
    padding: 0 0.25rem;
}

.stats-card-mobile {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.stats-card-mobile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.stats-card-mobile .card-body {
    padding: 1.2rem 0.8rem;
}

.stats-icon-mobile {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.stats-title-mobile {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: #666;
    font-weight: 500;
}

.stats-value-mobile {
    font-size: 1.4rem;
    font-weight: bold;
    margin: 0;
    color: #333;
}

/* 数据下载区域移动端优化 */
@media (max-width: 768px) {
    .card-header h5 {
        font-size: 1.1rem;
    }

    .card-body p.text-muted {
        font-size: 0.9rem;
        margin-bottom: 1.5rem !important;
    }

    .btn-lg {
        font-size: 1rem;
        padding: 0.8rem 1.5rem;
    }
}

@media (max-width: 576px) {
    .card-header h5 {
        font-size: 1rem;
    }

    .card-body p.text-muted {
        font-size: 0.85rem;
        margin-bottom: 1.2rem !important;
        line-height: 1.4;
    }

    .btn-lg {
        font-size: 0.9rem;
        padding: 0.7rem 1.2rem;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .card-header {
        padding: 1rem;
    }

    .card-header h5 {
        font-size: 0.95rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-body p.text-muted {
        font-size: 0.8rem;
        margin-bottom: 1rem !important;
    }

    .btn-lg {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }
}

/* 移动端专用样式优化 */
@media (max-width: 768px) {
    /* 状态指示器卡片在移动端的优化 */
    .mobile-status-row .col-3 {
        padding: 0;
    }

    /* 移动端左右布局温度湿度卡片优化 */
    .temperature-card,
    .humidity-card {
        border-radius: 12px;
        box-shadow: 0 3px 12px rgba(0,0,0,0.15);
        margin-bottom: 1.5rem;
    }

    .temperature-card:hover,
    .humidity-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    }

    /* 移动端统计卡片优化 */
    .stats-card-mobile .card-body {
        padding: 1rem 0.6rem;
    }

    .stats-icon-mobile {
        font-size: 1.8rem;
        margin-bottom: 0.4rem;
    }

    .stats-title-mobile {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    .stats-value-mobile {
        font-size: 1.3rem;
    }

    .status-indicator-mobile {
        padding: 0.8rem 0.2rem;
        min-height: 105px;
    }

    .status-indicator-mobile i {
        font-size: 1.3rem;
        margin-bottom: 0.4rem;
    }

    .status-indicator-mobile div {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    .status-indicator-mobile .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

@media (max-width: 576px) {
    /* 按钮组移动端特殊处理 */
    .btn-group-mobile {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 0.5rem;
    }

    .btn-group-mobile .btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
        border-radius: 6px !important;
        margin: 0;
    }

    /* 确保按钮在移动端有足够的触摸区域 */
    .btn {
        min-height: 44px;
        padding: 0.6rem 1rem;
    }

    /* 卡片标题在移动端的优化 */
    .card-header.flex-wrap {
        flex-direction: column;
        align-items: stretch !important;
    }

    .card-header h5 {
        text-align: center;
        margin-bottom: 1rem !important;
    }

    /* 移动端状态指示器进一步优化 */
    .status-indicator-mobile {
        padding: 0.7rem 0.15rem;
        min-height: 90px;
    }

    .status-indicator-mobile i {
        font-size: 1.2rem;
        margin-bottom: 0.3rem;
    }

    .status-indicator-mobile div {
        font-size: 0.75rem;
        margin-bottom: 0.3rem;
    }

    .status-indicator-mobile .badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }

    /* 移动端统计卡片进一步优化 */
    .stats-card-mobile .card-body {
        padding: 0.8rem 0.5rem;
    }

    .stats-icon-mobile {
        font-size: 1.6rem;
        margin-bottom: 0.3rem;
    }

    .stats-title-mobile {
        font-size: 0.75rem;
        margin-bottom: 0.3rem;
    }

    .stats-value-mobile {
        font-size: 1.2rem;
    }

    /* 温度湿度卡片在移动端的间距和优化 */
    .temperature-card,
    .humidity-card {
        margin-bottom: 1.2rem;
    }

    /* 移动端温度湿度卡片内容优化 - 左右布局 */
    .temperature-card .card-body,
    .humidity-card .card-body {
        padding: 1.2rem 0.8rem;
    }

    .temperature-value,
    .humidity-value {
        font-size: 1.8rem;
        margin: 0.8rem 0;
        line-height: 1.1;
    }

    .temperature-icon,
    .humidity-icon {
        font-size: 1.6rem;
        margin-bottom: 0.6rem;
    }

    .card-title {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }

    .temperature-trend,
    .humidity-trend {
        font-size: 0.8rem;
        margin-top: 0.6rem;
    }

    /* 确保左右布局时卡片间距合适 */
    .row.mb-4 .col-6:first-child {
        padding-right: 0.5rem;
    }

    .row.mb-4 .col-6:last-child {
        padding-left: 0.5rem;
    }

    /* 统计卡片在移动端的优化 */
    .row.mb-4:last-of-type .col-md-3 {
        margin-bottom: 1rem;
    }

    /* 表单控件在移动端的优化 */
    .form-check-input {
        transform: scale(1.2);
        margin-right: 0.8rem;
    }

    .form-check-label {
        font-size: 1rem;
        line-height: 1.4;
    }
}

/* 超小屏幕优化 (最大480px) */
@media (max-width: 480px) {
    .container-fluid {
        padding: 0 0.75rem;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .temperature-value,
    .humidity-value {
        font-size: 2rem;
    }

    .temperature-icon,
    .humidity-icon {
        font-size: 1.8rem;
    }

    .card-body {
        padding: 1.2rem 0.8rem;
    }

    .btn-group-mobile .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.3rem;
    }

    /* 超小屏幕状态指示器优化 */
    .status-indicator-mobile {
        padding: 0.6rem 0.1rem;
        min-height: 80px;
    }

    .status-indicator-mobile i {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }

    .status-indicator-mobile div {
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
        line-height: 1.1;
    }

    .status-indicator-mobile .badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.25rem;
        border-radius: 10px;
    }

    /* 温度湿度卡片进一步优化 - 超小屏幕左右布局 */
    .temperature-card .card-body,
    .humidity-card .card-body {
        padding: 1rem 0.6rem;
    }

    .temperature-value,
    .humidity-value {
        font-size: 1.6rem;
        margin: 0.6rem 0;
    }

    .temperature-icon,
    .humidity-icon {
        font-size: 1.4rem;
        margin-bottom: 0.4rem;
    }

    .card-title {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }

    .temperature-trend,
    .humidity-trend {
        font-size: 0.75rem;
        margin-top: 0.4rem;
    }

    /* 超小屏幕左右布局间距优化 */
    .row.mb-4 .col-6:first-child {
        padding-right: 0.25rem;
    }

    .row.mb-4 .col-6:last-child {
        padding-left: 0.25rem;
    }

    /* 超小屏幕统计卡片优化 */
    .stats-card-mobile .card-body {
        padding: 0.6rem 0.4rem;
    }

    .stats-icon-mobile {
        font-size: 1.4rem;
        margin-bottom: 0.25rem;
    }

    .stats-title-mobile {
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
        line-height: 1.1;
    }

    .stats-value-mobile {
        font-size: 1.1rem;
    }

    /* 超小屏幕统计卡片间距优化 */
    .mobile-stats-layout {
        margin: 0 -0.15rem;
    }

    .mobile-stats-layout .col-6 {
        padding: 0 0.15rem;
        margin-bottom: 0.5rem;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    header {
        padding: 1rem 0 !important;
        margin-bottom: 1rem !important;
    }

    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1.2rem;
    }

    /* 横屏模式下左右布局温度湿度卡片优化 */
    .temperature-value,
    .humidity-value {
        font-size: 1.8rem;
        margin: 0.8rem 0;
    }

    .temperature-icon,
    .humidity-icon {
        font-size: 1.6rem;
        margin-bottom: 0.6rem;
    }

    .card-title {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }

    .temperature-trend,
    .humidity-trend {
        font-size: 0.85rem;
        margin-top: 0.6rem;
    }

    /* 横屏模式下统计卡片优化 */
    .stats-card-mobile .card-body {
        padding: 0.8rem 0.5rem;
    }

    .stats-icon-mobile {
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
    }

    .stats-title-mobile {
        font-size: 0.75rem;
        margin-bottom: 0.3rem;
    }

    .stats-value-mobile {
        font-size: 1.1rem;
    }
}

/* 页脚布局优化 */
.footer-powered-by {
    font-size: 0.875rem;
}

.footer-language {
    margin-left: auto;
}

/* 内联语言切换器样式 */
.footer-language-inline {
    font-size: 0.875rem;
}

.language-switcher-inline {
    display: inline;
}

.language-link {
    color: #6c757d;
    text-decoration: none;
    font-size: inherit;
    transition: color 0.2s ease;
}

.language-link:hover {
    color: #495057;
    text-decoration: underline;
}

.language-link.active {
    color: #007bff;
    font-weight: 500;
}

/* 语言切换器样式 - 页脚版本 */
.language-switcher {
    z-index: 1000;
}

.language-switcher .btn {
    border: 1px solid #6c757d;
    background: transparent;
    color: #6c757d;
    font-size: 0.8rem;
    padding: 2px 8px;
    transition: all 0.3s ease;
    border-radius: 15px;
}

.language-switcher .btn:hover {
    background: #e9ecef;
    border-color: #495057;
    color: #495057;
}

.language-switcher .dropdown-menu {
    min-width: 120px;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.language-switcher .dropdown-item {
    font-size: 0.9rem;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.language-switcher .dropdown-item:hover {
    background-color: #f8f9fa;
}

.language-switcher .dropdown-item.active {
    background-color: #007bff;
    color: white;
}

/* 移动端页脚布局优化 */
@media (max-width: 768px) {
    .footer-language-inline {
        font-size: 0.8rem;
    }

    .language-link {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .footer-language-inline {
        font-size: 0.75rem;
    }

    .language-link {
        font-size: 0.75rem;
    }
}
