/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}
body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
/* 导航栏样式 */
nav {
    background: linear-gradient(135deg, #006600 0%, #11998e 100%);
    color: white;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
nav * {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 1.8rem;
    font-weight: 700;
}
.nav-links {
    display: flex;
    list-style: none;
}
.nav-links li {
    margin-left: 2rem;
    position: relative;
}
.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
    padding: 0.5rem 0;
    display: block;
}
.nav-links a:hover {
    opacity: 0.8;
}

/* 下拉菜单样式 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    list-style: none;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}
.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dropdown-menu li {
    margin: 0;
}
.dropdown-menu a {
    color: #333;
    padding: 0.75rem 1.5rem;
    display: block;
    transition: background-color 0.2s;
}
.dropdown-menu a:hover {
    background-color: #f5f5f5;
    opacity: 1;
}

/* ----- 主布局：侧边栏 + 内容 ----- */
.main-container {
    display: flex;
    flex: 1;
    max-width: 1400px;
    margin: 2rem auto;
    background: white;
    border-radius: 24px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    overflow: hidden;
    min-height: 600px;
}

/* 左侧日历侧边栏 */
.sidebar {
    width: 340px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    padding: 1.8rem 1.2rem;
    display: flex;
    flex-direction: column;
}

/* 日历头部 */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.calendar-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e293b;
    background: #f1f5f9;
    padding: 0.3rem 1rem;
    border-radius: 40px;
}
.month-nav {
    background: none;
    border: 1px solid #cbd5e1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    color: #334155;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.month-nav:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

/* 星期行 */
.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    background: #f8fafc;
    padding: 0.5rem 0;
    border-radius: 30px;
}

/* 日历网格 */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin: 0.5rem 0 1rem;
}
.calendar-date {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 500;
    color: #0f172a;
    background: #ffffff;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.calendar-date:hover {
    background: #e6f0ff;
    border-color: #b3d0ff;
    transform: scale(1.02);
}
.calendar-date.active {
    background: #2563eb !important;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(37,99,235,0.3);
}
/* 空白格子 (占位无点击) */
.calendar-grid .empty-cell {
    aspect-ratio: 1 / 1;
    background: transparent;
}
.calendar-footer {
    margin-top: auto;
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
    border-top: 1px dashed #d1d9e6;
    padding-top: 1rem;
}

/* 颜色预览面板 */
.color-preview-panel {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #f9fbfe;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.color-preview-panel.show {
    visibility: visible;
    opacity: 1;
}
.preview-header {
    padding: 0.8rem 1.2rem;
    background: #edf2f7;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.preview-header .toggle-icon {
    transition: transform 0.2s;
}
.preview-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}
.preview-content {
    padding: 1rem;
    transition: max-height 0.2s ease;
}
.preview-header.collapsed + .preview-content {
    display: none;
}
.slider-container {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: wrap;
}
.slider-container label {
    font-weight: 500;
    min-width: 100px;
}
.slider-container input {
    flex: 1;
    min-width: 200px;
}
.color-rect {
    width: 100%;
    height: 80px;
    border-radius: 20px;
    border: 2px solid #cbd5e1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    transition: background-color 0.2s;
    color: #000; /* 默认黑色，根据背景亮度动态覆盖 */
}
.color-rect.light-text {
    color: #fff;  /* 当背景较暗时，文字变为白色 */
}
.preset-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.preset-buttons button {
    background: #e2e8f0;
    border: none;
    padding: 0.3rem 1rem;
    border-radius: 30px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}
.preset-buttons button:hover {
    background: #cbd5e1;
}

/* ----- 右侧内容卡片 ----- */
.content {
    width: 500px;
    flex: 1;
    padding: 2rem;
    background: #fbfdff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.date-card {
    max-width: 500px;
    width: 100%;
    background: white;
    border-radius: 32px;
    padding: 2.5rem 2rem;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.02);
    border: 1px solid #eef2f6;
    text-align: center;
}
.date-card h2 {
    font-weight: 400;
    color: #475569;
    letter-spacing: 1px;
    margin-bottom: 1.2rem;
    font-size: 1.6rem;
}
.selected-date-info {
  position: relative;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: #0b1e33;
    background: #f0f4fa;
    border-radius: 60px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.8rem;
    border: 1px solid #dde7f0;
}
.placeholder {
    font-size: 1.2rem;
    color: #6f7d95;
    font-weight: 400;
}
.extra-content {
    color: #3a546d;
    background: #f8fafc;
    white-space: pre-line;
    padding: 1rem;
    border-radius: 30px;
    border: 1px dashed #b9c9da;
    font-size: 1rem;
}

/* ----- 编辑按钮 ----- */
.edit-btn {
    position: absolute;
    background: #2563eb;
    color: white;
    top: 18px;
    right: 0px;
    transform: translateY(-50%);
    border: none;
    border-radius: 40px;
    padding: 0.5rem;
    font-size: 1rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 4px 10px rgba(37,99,235,0.3);
    z-index: 2;
}
.edit-btn:hover {
    background: #1d4ed8;
}

/* ----- 模态层遮罩 ----- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ----- 模态卡片 ----- */
.modal-card {
    background: white;
    border-radius: 32px;
    max-width: 400px;
    width: 90%;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.modal-card h3 {
    margin-bottom: 1.5rem;
    color: #0f172a;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1.2rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: #334155;
    font-size: 0.9rem;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 30px;
    font-size: 1rem;
    transition: border 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-group textarea {
    border-radius: 20px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: flex-end;
    margin-top: 2rem;
}
.modal-actions button {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 40px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
#modalCancel {
    background: #e2e8f0;
    color: #334155;
}
#modalCancel:hover {
    background: #cbd5e1;
}
#modalSubmit {
    background: #2563eb;
    color: white;
}
#modalSubmit:hover {
    background: #1d4ed8;
}
.modal-error {
    color: #dc2626;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
}

/* 移动端适应 */
@media (max-width: 966px) {
    .main-container {
        flex-direction: column;
        margin: 1rem;
        border-radius: 20px;
    }
    .sidebar {
        margin: 0 auto;
        border-right: none;
    }
    .content {
        width: auto;
        padding: 1.5rem;
    }
    .selected-date-info {
        font-size: 2rem;
    }
    .mobile-menu {
        display: block;
        font-size: 1.5rem;
        cursor: pointer;
    }
}