/* 引入外部字体 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Roboto+Mono:wght@700&display=swap');

/* 全局样式和响应式布局 */
html {
    overflow-y: auto;
    /* 确保在需要时显示滚动条 */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    transition: background-color 0.5s ease-in-out;
    /* 为固定头部和侧边栏留出空间 */
    padding-top: 64px;
    padding-left: 100px;
}

/* 移除所有链接的下划线，并继承父元素颜色 */
a {
    text-decoration: none;
    color: inherit;
}

/* 闹钟响铃动画 */
body.alarm-ringing {
    animation: alarm-blink 1s infinite;
}

@keyframes alarm-blink {
    0% {
        background-color: #0d1117;
    }

    50% {
        background-color: #3d0e0e;
    }

    100% {
        background-color: #0d1117;
    }
}

/* 顶部头部 */
.header {
    background-color: #161b22;
    padding: 1rem 2rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
    /* 固定在顶部 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    /* 确保 padding 不会影响宽度 */
}

.domain-name {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.5rem;
    font-weight: bold;
    color: #60a5fa;
}

/* 侧边栏导航 */
.sidebar {
    position: fixed;
    /* 固定在左侧 */
    top: 64px;
    /* 留出顶部头部的高度 */
    left: 0;
    height: calc(100% - 64px);
    /* 减去顶部头部的高度 */
    width: 100px;
    /* 固定为窄小模式 */
    background-color: #161b22;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 99;
    align-items: center;
    /* 导航图标居中 */
}

.tabs {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
}

.tab-button {
    display: flex;
    flex-direction: column;
    /* 图标和文字垂直排列 */
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: #6b7280;
    padding: 1rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: color 0.3s ease, background-color 0.3s ease;
    border-radius: 4px;
    width: 80px;
    /* 固定宽度，防止抖动 */
}

.tab-button:hover {
    color: #c9d1d9;
    background-color: #2f363d;
}

.tab-button.active {
    color: #60a5fa;
    background-color: #2f363d;
}

.tab-button .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.tab-button .icon svg {
    width: 100%;
    height: 100%;
}

.tab-button .label {
    font-size: 0.8rem;
    white-space: nowrap;
    /* 防止换行 */
}

/* 主体内容容器 */
.container {
    width: auto;
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* 内容区块样式 */
.content-section {
    width: 100%;
    text-align: center;
    max-width: 2400px;
    margin: 0 auto;
}

/* 标题和时间显示 */
.title {
    font-size: calc(1.5rem + 2vw);
    /* 动态缩放 */
    font-weight: bold;
    margin-bottom: 1rem;
}

.time-display {
    font-family: 'Roboto Mono', monospace;
    font-size: calc(3rem + 7vw);
    /* 动态缩放 */
    font-weight: 800;
    color: #60a5fa;
    margin: 2rem 0;
    display: block;
}

.date-container {
    font-size: calc(1rem + 1vw);
    /* 动态缩放 */
    color: #9ca3af;
}

/* 列表样式 */
.world-clock-list,
.alarm-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    text-align: left;
    width: 100%;
}

.world-clock-item,
.alarm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(1.5rem + 0.5vw);
    /* 动态缩放 */
    border-bottom: 1px solid #2f363d;
    transition: background-color 0.2s ease;
}

.world-clock-item:hover,
.alarm-item:hover {
    background-color: #1a202c;
}

.world-clock-item:last-child,
.alarm-item:last-child {
    border-bottom: none;
}

.world-clock-item .city,
.alarm-item .alarm-time {
    font-size: calc(1.2rem + 0.6vw);
    /* 动态缩放 */
    font-weight: 600;
    color: #c9d1d9;
}

.world-clock-item .time,
.alarm-item .alarm-time {
    font-family: 'Roboto Mono', monospace;
    color: #60a5fa;
    font-size: calc(1.2rem + 0.6vw);
    /* 动态缩放 */
}

/* 控制按钮和输入框 */
.controls,
.alarm-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.timer-input,
.alarm-input,
.city-input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid #2f363d;
    background-color: #161b22;
    color: #c9d1d9;
    border-radius: 4px;
    text-align: center;
}

.control-button,
.delete-button,
.button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.delete-button {
    background-color: #dc3545;
    color: white;
}

#start-timer,
#start-stopwatch,
#set-alarm,
#add-city {
    background-color: #28a745;
    color: white;
}

#pause-timer,
#pause-stopwatch {
    background-color: #ffc107;
    color: black;
}

#reset-timer,
#reset-stopwatch {
    background-color: #dc3545;
    color: white;
}

/* 通知弹窗 */
.notification-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #161b22;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    text-align: center;
    border: 1px solid #2f363d;
    max-width: 300px;
    animation: fadeIn 0.3s ease-in-out;
}

.notification-modal .button {
    background-color: #60a5fa;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

/* 响应式设计：针对平板和手机设备 */
@media (max-width: 768px) {

    /* 重置 body 的 padding */
    body {
        padding-top: 0;
        padding-left: 0;
    }

    /* 移除固定定位，让元素自然流淌 */
    .header {
        position: relative;
        padding: 1rem;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        top: 0;
        box-shadow: none;
    }

    /* 导航栏变为水平布局 */
    .tabs {
        flex-direction: row;
        justify-content: space-around;
        flex-wrap: wrap;
    }

    .tab-button {
        width: auto;
        padding: 0.5rem;
        flex: 1;
        /* 自动分配空间 */
    }

    .tab-button .label {
        font-size: 0.75rem;
    }

    /* 主体内容占据整个宽度 */
    .container {
        margin-left: 0;
        margin-top: 0;
        padding: 1rem;
    }

    .content-section {
        max-width: 100%;
        padding: 0 0.5rem;
    }

    /* 手机端字体大小 */
    .title {
        font-size: 1.5rem;
    }

    .time-display {
        font-size: 2.5rem;
    }

    .date-container {
        font-size: 1rem;
    }
}