/**
 * 设备天气时钟配置模块专用样式
 * 不依赖Bootstrap CSS，避免样式冲突
 */

/* 定义minimal字体，用于除城市外的其他显示元素 */
@font-face {
    font-family: 'MinimalFont';
    src: url('../font/minimal.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 模态框基础样式 */
.weather-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.weather-modal.show {
    opacity: 1;
    visibility: visible;
}

.weather-modal-dialog {
    position: relative;
    width: calc(100% - 20px);
    max-width: 800px;
    max-height: calc(100vh - 20px);
    background-color: #fff;
    border-radius: 0.3rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 模态框头部 */
.weather-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.weather-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.5;
}

.weather-modal-close {
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-modal-close:hover {
    opacity: 0.75;
}

/* 模态框主体 */
.weather-modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 0.5rem;
    overflow-y: auto;
}

/* 模态框底部 */
.weather-modal-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    padding: 0.5rem;
    border-top: 1px solid #dee2e6;
}

.weather-modal-footer .btn {
    margin-left: 0.5rem;
}

.weather-modal-footer .btn:first-child {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* 卡片样式 */
.weather-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.25rem;
}

.weather-card-header {
    padding: 0.75rem 1.25rem;
    margin-bottom: 0;
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.weather-card-header h5 {
    margin: 0;
    font-size: 1rem;
}

.weather-card-body {
    flex: 1 1 auto;
    min-height: 1px;
    padding: 1.25rem;
}

/* 表单样式 */
.weather-form-group {
    margin-bottom: 0.2rem;
}

.weather-form-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.weather-form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.weather-form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.weather-form-control-color {
    max-width: 5rem;
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.5rem;
}

.weather-form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #6c757d;
}

.weather-form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5rem;
    margin-bottom: 0.125rem;
}

.weather-form-check-input {
    float: left;
    margin-left: -1.5rem;
}

.weather-form-check-label {
    font-weight: 400;
}

/* 输入组 */
.weather-input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.weather-input-group-append {
    margin-left: -1px;
    display: flex;
}

.weather-input-group > .weather-form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
    margin-bottom: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.weather-btn {
    display: inline-block;
    font-weight: 400;
    color: #212529;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
}

.weather-btn:hover {
    color: #212529;
    text-decoration: none;
}

.weather-btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.weather-btn-outline-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

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

.weather-btn-primary:hover {
    color: #fff;
    background-color: #0069d9;
    border-color: #0062cc;
}

.weather-btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.weather-btn-secondary:hover {
    color: #fff;
    background-color: #5a6268;
    border-color: #545b62;
}

.weather-btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}

/* 网格系统 */
.weather-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.weather-col-md-5 {
    flex: 0 0 50%;
    max-width: 50%;
}

.weather-col-md-7 {
    flex: 0 0 50%;
    max-width: 50%;
}

.weather-col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

/* 其他样式 */
.weather-sticky-top {
}

.weather-text-center {
    text-align: center;
}

.weather-mt-3 {
    margin-top: 1rem;
}

.weather-mt-2 {
    margin-top: 0.5rem;
}

/* 预览画布 */
.weather-preview-canvas {
    width: 320px;
    height: 240px;
    border: 1px solid #ddd;
    margin: 0 auto;
    position: relative;
    background-color: #000;
    overflow: hidden;
}

/* 预览画布中的所有文字元素使用minimal字体 */
.weather-preview-canvas > div {
    font-family: 'MinimalFont', sans-serif !important;
    /* 确保容器紧贴文字，避免坐标定位误差 */
    white-space: nowrap;
    padding: 0;
    margin: 0;
    line-height: 1;
    display: inline-block;
    max-width: none;
}

/* 城市显示使用默认字体，不使用minimal字体 */
.weather-preview-canvas > #previewCity {
    font-family: sans-serif !important;
}

/* 布局 */
.weather-layout {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* 区块 */
.weather-section {
    margin-bottom: 1.5rem;
}

/* 配置项标题 */
.weather-config-header {
    padding: 8px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    margin-bottom: 0;
    font-weight: bold;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

/* 配置区域主标题 */
.weather-section-title {
    text-align: center;
    font-weight: bold;
    color: #333;
}

/* 开关切换按钮 */
.weather-toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    margin-right: 10px;
}

.weather-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.weather-toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.weather-toggle-label:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.weather-toggle-input:checked + .weather-toggle-label {
    background-color: #007bff;
}

.weather-toggle-input:checked + .weather-toggle-label:before {
    transform: translateX(20px);
}

/* 配置项标题 */
.weather-config-title {
    flex-grow: 1;
    margin: 0;
}

/* 配置项展开/折叠按钮 */
.weather-config-toggle {
    cursor: pointer;
    padding: 0 10px;
}

/* 配置项内容 */
.weather-config-content {
    display: block;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

/* 表单行 */
.weather-form-row {
    margin-bottom: 10px;
}

/* 表单组内联显示 */
.weather-form-row .weather-form-group {
    display: inline-block;
    width: 48%;
    margin-right: 2%;
}

.weather-form-row .weather-form-group:last-child {
    margin-right: 0;
}

/* 滚动条样式 */
.weather-scrollable {
    height: 500px;
    overflow-y: auto;
    padding-right: 15px;
}

/* 列表组 */
.weather-list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
}

.weather-list-group-item {
    position: relative;
    display: block;
    padding: 0.75rem 1.25rem;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.125);
    cursor: pointer;
    text-align: left;
}

.weather-list-group-item:first-child {
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
}

.weather-list-group-item:last-child {
    border-bottom-right-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.weather-list-group-item:hover {
    z-index: 1;
    text-decoration: none;
    background-color: #f8f9fa;
}

/* 警告框 */
.weather-alert {
    position: relative;
    padding: 0.5rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.weather-alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.weather-alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* 自定义文件输入 */
.weather-custom-file {
    position: relative;
    display: inline-block;
    width: 100%;
    height: calc(1.5em + 0.75rem + 2px);
    margin-bottom: 0;
}

/* 背景图片预览 */
.weather-background-preview {
    margin-top: 10px;
    text-align: center;
}

.weather-background-preview img {
    max-width: 100%;
    max-height: 150px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
/* 剪裁背景图片按钮 */
.weather-btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
}

.weather-btn-outline-primary:hover {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}
/* 删除背景图片按钮 */
.weather-btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

.weather-btn-outline-danger:hover {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.weather-custom-file-input {
    position: relative;
    z-index: 2;
    width: 100%;
    height: calc(1.5em + 0.75rem + 2px);
    margin: 0;
    opacity: 0;
}

.weather-custom-file-label {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1;
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.weather-custom-file-label::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: block;
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
    color: #495057;
    content: "浏览";
    background-color: #e9ecef;
    border-left: inherit;
    border-radius: 0 0.25rem 0.25rem 0;
}

/* 加载动画 */
.weather-spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: weather-spinner-border 0.75s linear infinite;
}

.weather-spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

@keyframes weather-spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .weather-col-md-5,
    .weather-col-md-7 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .weather-modal-dialog {
        max-width: calc(100% - 10px);
        margin: 5px;
        max-height: 80vh; /* 进一步增加高度为视口的80%，显示更多内容 */
    }
    
    .weather-scrollable {
        height: auto;
        max-height: 300px;
    }
}