/**
 * 小组件容器样式
 * 参考导航网格容器的高度和配色
 * 适配全局主题CSS变量
 */

/* 小组件容器 */
.widget-container {
    width: 100%;
    margin: 12px 0;
    padding: 0 8px;
    background: var(--bg-primary);
    border-top: 1px solid var(--bg-border);
    border-bottom: 1px solid var(--bg-border);
    border-left: none;
    border-right: none;
    border-radius: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: none;
}

/* 极简模式样式 */
body.minimal-style .widget-container {
    background: var(--bg-primary);
    border-top: 1px solid var(--bg-border);
    border-bottom: 1px solid var(--bg-border);
    border-left: none;
    border-right: none;
    box-shadow: none;
}

/* 小组件包装器 - 单行居中排列 */
.widget-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 12px 0;
}

/* 单个小组件 */
.widget-item {
    background: transparent;
    border: 1px solid var(--bg-border);
    border-radius: var(--border-radius);
    padding: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 200px;
    height: 150px; /* 增加高度适应4行布局 */
    cursor: move;
    transition: all var(--transition-fast);
    user-select: none;
    -webkit-user-select: none;
}

/* 拖动状态 */
.widget-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    z-index: 1000;
}

/* 拖动悬停状态 */
.widget-item.drag-over {
    border-color: var(--link-color);
    transform: scale(1.02);
}

/* 极简模式样式 */
body.minimal-style .widget-item {
    background: transparent;
    border-color: var(--bg-border);
    box-shadow: none;
    cursor: move;
    transition: all var(--transition-fast);
    user-select: none;
    -webkit-user-select: none;
}

/* 极简模式拖动状态 */
body.minimal-style .widget-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    z-index: 1000;
}

/* 极简模式拖动悬停状态 */
body.minimal-style .widget-item.drag-over {
    border-color: var(--link-color);
    transform: scale(1.02);
}

/* 小组件标题 */
.widget-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color) !important;
    margin: 0;
    text-align: center;
    letter-spacing: 0.5px;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: transparent;
    border-radius: calc(var(--border-radius) - 1px) calc(var(--border-radius) - 1px) 0 0;
}

/* 小组件内容区 - 统一高度和对齐 */
.widget-content {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 改为顶部对齐 */
    overflow: hidden;
    height: calc(100% - 33px); /* 减去标题高度 */
}

/* 加载文本 */
.loading-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 20px 0;
}

/* 移除可能冲突的全局样式，只保留组件内样式 */

/* 统一的小组件内部布局样式 - 确保每行都在同一水平线 */
.calendar-content-wrapper,
.clock-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    justify-content: flex-start; /* 顶部对齐 */
}

/* 统一的行高和位置 - 第1行 */
.calendar-content-wrapper .calendar-date,
.clock-content-wrapper .clock-time {
    height: 32px; /* 固定行高 */
    line-height: 32px; /* 垂直居中 */
    font-size: 16px;
    color: var(--text-color);
    font-weight: 600;
    text-align: center;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 时钟字体特殊处理 - 保持同样大小 */
.clock-content-wrapper .clock-time {
    font-family: 'Courier New', monospace;
    font-size: 20px; /* 与日历日期同样大小 */
}

/* 统一的行高和位置 - 第2行 */
.calendar-content-wrapper .calendar-week,
.clock-content-wrapper .clock-countdown {
    height: 20px; /* 固定行高 */
    line-height: 20px; /* 垂直居中 */
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 统一的行高和位置 - 第3行 */
.calendar-content-wrapper .calendar-festival,
.clock-content-wrapper .clock-stopwatch {
    height: 18px; /* 固定行高 */
    line-height: 18px; /* 垂直居中 */
    font-size: 10px;
    color: var(--link-color);
    text-align: center;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 统一的行高和位置 - 第4行 */
.calendar-content-wrapper .calendar-reminder,
.clock-content-wrapper .clock-alarms {
    height: 18px; /* 固定行高 */
    line-height: 18px; /* 垂直居中 */
    font-size: 10px;
    color: var(--warning-color);
    text-align: center;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 移除重复的颜色定义 - 已在上面的详细样式中定义 */

/* 响应式设计 */
@media (max-width: 768px) {
    .widget-container {
        padding: 0 4px;
        margin: 8px 0;
    }
    
    .widget-wrapper {
        gap: 12px;
    }
    
    .widget-item {
        width: 180px;
        height: 150px; /* 增加高度适应4行布局 */
    }
    
    .widget-title {
        font-size: 12px;
        padding: 6px 0;
    }
    
    /* 移动端统一样式 - 保持行高一致 */
    .calendar-content-wrapper .calendar-date,
    .clock-content-wrapper .clock-time {
        font-size: 12px;
        height: 28px;
        line-height: 28px;
    }
    
    .calendar-content-wrapper .calendar-week,
    .clock-content-wrapper .clock-countdown {
        font-size: 10px;
        height: 18px;
        line-height: 18px;
    }
    
    .calendar-content-wrapper .calendar-festival,
    .clock-content-wrapper .clock-stopwatch {
        font-size: 9px;
        height: 16px;
        line-height: 16px;
    }
    
    .calendar-content-wrapper .calendar-reminder,
    .clock-content-wrapper .clock-alarms {
        font-size: 9px;
        height: 16px;
        line-height: 16px;
    }
}

@media (max-width: 480px) {
    .widget-wrapper {
        gap: 8px;
        padding: 0 4px;
    }
    
    .widget-item {
        width: 160px;
        height: 140px; /* 保持高度一致 */
    }
    
    .widget-title {
        font-size: 11px;
        padding: 5px 0;
    }
    
    .widget-content {
        padding: 6px;
    }
}

/* 确保小屏幕下不会换行 */
@media (max-width: 380px) {
    .widget-wrapper {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    
    .widget-wrapper::-webkit-scrollbar {
        height: 4px;
    }
    
    .widget-wrapper::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .widget-wrapper::-webkit-scrollbar-thumb {
        background: var(--bg-border);
        border-radius: 2px;
    }
}