:root {
    /* 浅色模式变量 */
    --bg-color: #f5f5f5;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --accent-color: #4CAF50;
    --urgent-color: #f44336;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    /* 深色模式变量 */
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --border-color: #333;
    --accent-color: #4CAF50;
    --urgent-color: #f44336;
    --shadow: 0 2px 4px rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #555;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #777;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
    min-height: 100vh;
}

/* 主题切换按钮 */
.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Header */
.header {
    background: var(--card-bg);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.greeting {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.greeting-main {
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
    animation: fadeIn 0.8s ease-in-out;
}

.greeting-sub {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.8;
    white-space: nowrap;
    animation: fadeIn 0.8s ease-in-out;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quick-search {
    flex: 1;
    max-width: 600px;
}

.quick-search input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.quick-search input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.clock-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.clock {
    font-size: 36px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}

/* 主内容区 */
.main-content {
    display: flex;
    gap: 20px;
    padding: 0 20px 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* 侧边栏 */
.sidebar {
    width: 250px;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sidebar h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--text-color);
}

.quick-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
    position: relative;
}

.quick-links.scroll-mask-top::before,
.quick-links.scroll-mask-bottom::after {
    content: '';
    position: sticky;
    left: 0;
    right: 0;
    height: 15px;
    pointer-events: none;
    z-index: 10;
}

.quick-links.scroll-mask-top::before {
    top: 0;
    background: linear-gradient(to bottom, var(--card-bg) 0%, transparent 100%);
    margin-bottom: -15px;
}

.quick-links.scroll-mask-bottom::after {
    bottom: 0;
    background: linear-gradient(to top, var(--card-bg) 0%, transparent 100%);
    margin-top: -15px;
}

.quick-link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 6px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.quick-link-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.quick-link-item a {
    color: var(--text-color);
    text-decoration: none;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-link-item .link-actions {
    display: flex;
    gap: 5px;
}

.quick-link-item button {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.7;
    cursor: pointer;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.quick-link-item button:hover {
    background: var(--border-color);
    opacity: 1;
    transform: translateY(-1px);
}

.add-link-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.add-link-btn:hover {
    background: #45a049;
}

/* 主网格区域 */
.grid-container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 0.7fr 0.8fr;
    grid-template-rows: auto;
    gap: 20px;
    grid-template-areas:
        "weather todo pomodoro"
        "mood todo pomodoro";
}

/* 天气仪表盘 */
.weather-dashboard {
    grid-area: weather;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.weather-dashboard h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.weather-current {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weather-location {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.weather-temp {
    font-size: 48px;
    font-weight: 600;
    line-height: 1;
}

.weather-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.weather-humidity {
    font-size: 14px;
    color: #666;
}

/* 待办清单 */
.todo-list {
    grid-area: todo;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.todo-items {
    flex: 1;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
    position: relative;
}

.todo-items.scroll-mask-top::before,
.todo-items.scroll-mask-bottom::after {
    content: '';
    position: sticky;
    left: 0;
    right: 0;
    height: 15px;
    pointer-events: none;
    z-index: 10;
}

.todo-items.scroll-mask-top::before {
    top: 0;
    background: linear-gradient(to bottom, var(--card-bg) 0%, transparent 100%);
    margin-bottom: -15px;
}

.todo-items.scroll-mask-bottom::after {
    bottom: 0;
    background: linear-gradient(to top, var(--card-bg) 0%, transparent 100%);
    margin-top: -15px;
}

.todo-list h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.todo-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.todo-controls input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
}

.todo-controls select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
}

.todo-controls button {
    padding: 10px 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.todo-controls button:hover {
    background: #45a049;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    cursor: grab;
}

.todo-item:hover {
    box-shadow: var(--shadow);
}

.todo-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.quick-link-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.todo-item.urgent {
    border-left: 4px solid var(--urgent-color);
}

.todo-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.todo-item .todo-text {
    flex: 1;
    font-size: 14px;
}

.todo-item .todo-actions {
    display: flex;
    gap: 5px;
}

.todo-item button {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.7;
    cursor: pointer;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.todo-item button:hover {
    background: var(--border-color);
    opacity: 1;
    transform: translateY(-1px);
}

/* 专注模式 */
.pomodoro {
    grid-area: pomodoro;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    height: 100%;
}

.pomodoro h3 {
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
    width: 100%;
    text-align: center;
}

.pomodoro-timer {
    font-size: 48px;
    font-weight: 700;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    color: var(--text-color);
    width: 100%;
    text-align: center;
}

.pomodoro-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-top: auto;
    margin-bottom: 10px;
}

.pomodoro-controls button {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    flex: 1;
    text-align: center;
    min-width: 70px;
}

#start-pomodoro {
    background: #4CAF50;
    color: white;
}

#start-pomodoro:hover {
    background: #45a049;
    transform: translateY(-2px);
}

#pause-pomodoro {
    background: #FF9800;
    color: white;
}

#pause-pomodoro:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

#reset-pomodoro {
    background: #F44336;
    color: white;
}

#reset-pomodoro:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

/* 专注模式统计 */
.pomodoro-stats {
    width: 100%;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* 分段控件 */
.segmented-control {
    display: flex;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 10px;
}

.segment-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.segment-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 专注统计 */
.focus-summary {
    text-align: center;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-color);
    font-weight: 500;
}

/* 成就图标 */
.achievement-icon {
    text-align: center;
    font-size: 20px;
    margin-bottom: 8px;
    animation: bounce 1s ease-in-out infinite;
}

/* 柱状图容器 */
.chart-container {
    margin-top: 10px;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 120px;
    gap: 6px;
    margin-bottom: 8px;
}

.chart-bar {
    flex: 1;
    background: var(--accent-color);
    border-radius: 4px 4px 0 0;
    min-height: 10px;
    transition: all 0.5s ease;
    animation: growUp 1s ease-out forwards;
    transform-origin: bottom;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.chart-label {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: var(--text-color);
}

/* 动画 */
@keyframes growUp {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}



/* 心情记录 */
.mood-tracker {
    grid-area: mood;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mood-options {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.mood-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.mood-header h3 {
    margin: 0;
    font-size: 16px;
    white-space: nowrap;
}

.mood-indicator {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    transition: all 0.3s ease;
}

.mood-score {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-width: 40px;
    text-align: right;
}

.mood-indicator.happy {
    background: #4CAF50;
}

.mood-indicator.excited {
    background: #FF9800;
}

.mood-indicator.calm {
    background: #2196F3;
}

.mood-indicator.tired {
    background: #FFC107;
}

.mood-indicator.sad {
    background: #9C27B0;
}

.mood-indicator.angry {
    background: #F44336;
}

.mood-indicator.anxious {
    background: #FF5722;
}

.mood-indicator.confused {
    background: #607D8B;
}

.mood-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.mood-btn {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    font-size: 18px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mood-btn[data-mood="happy"] {
    border-color: #4CAF50;
}

.mood-btn[data-mood="excited"] {
    border-color: #FF9800;
}

.mood-btn[data-mood="calm"] {
    border-color: #2196F3;
}

.mood-btn[data-mood="tired"] {
    border-color: #FFC107;
}

.mood-btn[data-mood="sad"] {
    border-color: #9C27B0;
}

.mood-btn[data-mood="angry"] {
    border-color: #F44336;
}

.mood-btn[data-mood="anxious"] {
    border-color: #FF5722;
}

.mood-btn[data-mood="confused"] {
    border-color: #607D8B;
}

.mood-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.mood-btn:active {
    animation: bounce 0.5s ease-in-out;
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* 心情颜色 */
.mood-happy {
    color: #4CAF50;
}

.mood-excited {
    color: #FF9800;
}

.mood-calm {
    color: #2196F3;
}

.mood-tired {
    color: #FFC107;
}

.mood-sad {
    color: #9C27B0;
}

.mood-angry {
    color: #F44336;
}

.mood-anxious {
    color: #FF5722;
}

.mood-confused {
    color: #607D8B;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    display: none;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    width: 400px;
    max-width: 90%;
    animation: slideUp 0.3s ease;
}

.modal-content h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    margin-bottom: 10px;
}

.priority-selector {
    margin-top: 10px;
}

.modal-content button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-right: 10px;
}

#save-link-btn,
.save-btn {
    background: var(--accent-color);
    color: white;
    border-radius: 6px;
}

#save-link-btn:hover,
.save-btn:hover {
    background: #45a049;
}

#cancel-link-btn,
.cancel-btn {
    background: #666;
    color: white;
    border-radius: 6px;
}

#cancel-link-btn:hover,
.cancel-btn:hover {
    background: #555;
}

/* 动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .grid-container {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "weather todo"
            "pomodoro todo"
            "mood mood"
            "search search";
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: -1;
    }
    
    .grid-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "weather"
            "todo"
            "pomodoro"
            "mood"
            "search";
    }
    
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}