:root {
  --primary-color: #307eef;
  --secondary-color: #4d90f2;
  --accent-color: #377cf2;
  --background-color: #f5f7fa;
  --card-color: #ffffff;
  --text-color: #333333;
  --text-light: #666666;
  --border-color: #dddddd;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --error-color: #dc3545;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, var(--background-color) 0%, #c3cfe2 100%);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

header {
  text-align: center;
  padding: 20px;
  background: var(--card-color);
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 {
  color: var(--primary-color);
  font-size: 2rem;
}

.subtitle {
  color: var(--secondary-color);
  font-size: 1.1rem;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 15px;
  background: #f0f5ff;
  border-radius: 20px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.user-name {
  font-weight: bold;
  color: var(--primary-color);
}

.main-content {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.sidebar {
  flex: 1;
  min-width: 300px;
  background: var(--card-color);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.diary-editor {
  flex: 2;
  min-width: 600px;
  background: var(--card-color);
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

/* 可折叠日期选择器样式 */
.date-selector {
  margin-bottom: 10px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e9ecef;
  transition: all 0.3s;
}

.date-selector.compact {
  background: #f8f9fa;
}

.date-selector.expanded {
  background: white;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.date-selector-header {
  padding: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.date-selector-header:hover {
  background: #f0f5ff;
}

.date-selector-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--primary-color);
}

.date-arrow {
  transition: transform 0.3s;
  color: var(--primary-color);
}

.date-selector.expanded .date-arrow {
  transform: rotate(180deg);
}

.current-date-display {
  font-size: 12px;
  font-weight: bold;
  color: var(--text-color);
  text-align: center;
  padding: 10px 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.date-selector-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.date-selector.expanded .date-selector-content {
  max-height: 500px;
}

.calendar {
  padding: 0 15px 15px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.calendar-header h3 {
  color: var(--primary-color);
  font-size: 16px;
}

.calendar-header button {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--primary-color);
  padding: 5px 10px;
  border-radius: 5px;
  transition: background 0.2s;
}

.calendar-header button:hover {
  background: #f0f5ff;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 15px;
}

.calendar-day {
  text-align: center;
  font-weight: bold;
  color: var(--secondary-color);
  padding: 8px 0;
  font-size: 14px;
}

.calendar-date {
  text-align: center;
  padding: 0 0 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  font-size: 14px;
}

.calendar-date:hover {
  background: #f0f5ff;
}

.calendar-date.active {
  background: var(--primary-color);
  color: white;
}

.calendar-date.has-diary::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  background: var(--error-color);
  border-radius: 50%;
}

.calendar-date.other-month {
  color: #ccc;
}

.calendar-date.today {
  background: #e6eeff;
  color: var(--primary-color);
  font-weight: bold;
}

.date-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0 15px 15px;
}

.date-action-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  text-align: center;
}

.date-action-btn:hover {
  background: #f8f9fa;
  border-color: var(--primary-color);
}

.date-action-btn.primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.date-action-btn.primary:hover {
  background: #3a5a80;
}

.title-input {
  margin-bottom: 20px;
}

.title-input input {
  width: 100%;
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  background: #f9f9f9;
}

.content-textarea {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  min-height: 200px;
}

.content-textarea textarea {
  flex: 1;
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  resize: none;
  line-height: 1.6;
  background: #f9f9f9;
  min-height: 200px;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}

button {
  padding: 8px 16px;
  background: var(--secondary-color);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s;
  align-items: center;
  gap: 8px;
}

.save-btn {
  background: var(--primary-color);
  color: white;
}

.save-btn:hover {
  background: #3a5a80;
  transform: translateY(-2px);
}

.new-btn {
  background: var(--secondary-color);
  color: white;
}

.new-btn:hover {
  background: #5a7ba9;
  transform: translateY(-2px);
}

.attach-btn {
  background: var(--accent-color);
  color: white;
}

.attach-btn:hover {
  background: #7a97c5;
  transform: translateY(-2px);
}

.diary-list {
  margin-top: 5px;
  overflow-y: auto;
  max-height: 400px;
  flex: 1;
}

.date-group {
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #eee;
}

.date-header {
  padding: 12px 15px;
  background: #f8f9fa;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s;
  border-bottom: 1px solid #eee;
}

.date-header:hover {
  background: #e9ecef;
}

.date-header.active {
  background: var(--primary-color);
  color: white;
}

.date-title {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-count {
  background: var(--secondary-color);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.date-header.active .date-count {
  background: white;
  color: var(--primary-color);
}

.date-arrow {
  transition: transform 0.3s;
}

.date-header.active .date-arrow {
  transform: rotate(180deg);
}

.diary-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.date-group.expanded .diary-items {
  max-height: 1000px;
}

.diary-item {
  padding: 15px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.2s;
}

.diary-item:last-child {
  border-bottom: none;
}

.diary-item:hover {
  background-color: #f8f9fa;
}

.diary-item.active {
  background-color: #e6eeff;
}

.diary-date {
  font-size: 14px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 5px;
}

.diary-title {
  font-weight: bold;
  margin: 8px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--primary-color);
}

.diary-preview {
  font-size: 14px;
  color: var(--text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 40px 0;
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 15px;
  color: #c3cfe2;
}

.status-bar {
  margin-top: 15px;
  font-size: 14px;
  color: var(--text-light);
  text-align: right;
  padding: 10px;
  background: #f0f5ff;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
}

.search-box {
  margin-bottom: 5px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 15px 12px 40px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
}

.search-box i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.attachments-section {
  margin-top: 20px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.attachments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.attachments-title {
  font-weight: bold;
  color: var(--primary-color);
  font-size: 18px;
}

.attachments-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}

.attachment-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s;
  background: #f9f9f9;
}

.attachment-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.attachment-preview {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f5ff;
  overflow: hidden;
}

.attachment-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.attachment-preview video {
  max-width: 100%;
  max-height: 100%;
}

.attachment-preview audio {
  width: 100%;
}

.attachment-preview .file-icon {
  font-size: 40px;
  color: var(--primary-color);
}

.attachment-info {
  padding: 10px;
}

.attachment-name {
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.attachment-actions {
  display: flex;
  justify-content: space-between;
}

.attachment-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary-color);
  font-size: 14px;
  padding: 5px;
}

.attachment-btn:hover {
  color: #3a5a80;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--card-color);
  border-radius: 10px;
  width: 350px;
  overflow: auto;
  padding: 20px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
}

.modal-close:hover {
  color: var(--text-color);
}

.modal-body {
  margin-top: 20px;
}

.modal-body img,
.modal-body video {
  width: 100%;
}

.modal-body audio {
  width: 100%;
}

.modal-body iframe {
  width: 100%;
  height: 70vh;
  border: none;
}

.file-input {
  display: none;
}

@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
  }

  .sidebar,
  .diary-editor {
    min-width: 100%;
  }

  .attachments-container {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .header-actions {
    flex-direction: column;
    gap: 10px;
  }

  header {
    flex-direction: column;
    gap: 15px;
  }
}

/* 登录相关样式 */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 70vh;
  text-align: center;
}

.login-box {
  background: var(--card-color);
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  width: 100%;
}

.login-title {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 1.4rem;
}

.login-description {
  color: var(--text-light);
  margin-bottom: 10px;
  line-height: 1.6;
}

.wechat-login-btn {
  background: #07c160;
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  transition: all 0.3s;
}

.wechat-login-btn:hover {
  background: #06ae56;
  transform: translateY(-2px);
}

/* 登录选项样式 */
.login-options {
  margin-top: 20px;
}

.divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--text-light);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.divider span {
  padding: 0 15px;
}

.password-login-btn {
  background: var(--primary-color);
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  transition: all 0.3s;
}

.password-login-btn:hover {
  background: #3a5a80;
  transform: translateY(-2px);
}

.demo-login {
  margin-top: 20px;
  color: var(--text-light);
  font-size: 14px;
}

.demo-login a {
  color: var(--primary-color);
  text-decoration: none;
  cursor: pointer;
}

.demo-login a:hover {
  text-decoration: underline;
}

.user-menu {
  position: relative;
}

.user-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary-color);
  font-size: 16px;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card-color);
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  padding: 10px 0;
  min-width: 150px;
  display: none;
  z-index: 100;
}

.user-dropdown.show {
  display: block;
}

.user-dropdown-item {
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-dropdown-item:hover {
  background: #f0f5ff;
}

.user-dropdown-divider {
  height: 1px;
  background: #eee;
  margin: 5px 0;
}

.stats-container {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.stat-item {
  background: #f0f5ff;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  flex: 1;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
}

.security-notice {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #856404;
}

.security-notice i {
  margin-right: 8px;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 表单样式 */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: var(--text-color);
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-actions {
  margin: 25px 0 15px;
}

.form-footer {
  text-align: center;
  color: var(--text-light);
}

.form-footer a {
  color: var(--primary-color);
  text-decoration: none;
  cursor: pointer;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* 绑定状态样式 */
.bind-status {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.bind-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.bind-item:last-child {
  border-bottom: none;
}

.bind-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bind-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.bind-icon.wechat {
  background: #07c160;
  color: white;
}

.bind-icon.password {
  background: var(--primary-color);
  color: white;
}

.bind-details h4 {
  margin: 0 0 5px 0;
  color: var(--text-color);
}

.bind-details p {
  margin: 0;
  color: var(--text-light);
  font-size: 14px;
}

.bind-status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.bind-status-badge.bound {
  background: #d4edda;
  color: #155724;
}

.bind-status-badge.unbound {
  background: #f8d7da;
  color: #721c24;
}

/* 绑定操作样式 */
.bind-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bind-action-btn {
  padding: 12px 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
}

.bind-action-btn:hover {
  background: #f0f5ff;
  border-color: var(--primary-color);
}

.bind-action-btn:disabled {
  background: #f8f9fa;
  color: var(--text-light);
  cursor: not-allowed;
  border-color: #eee;
}

.bind-action-btn .action-text {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bind-action-btn .action-icon {
  color: var(--primary-color);
}

.security-notice {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
  font-size: 14px;
  color: #856404;
}

.security-notice i {
  margin-right: 8px;
}

/* 文件类型徽章 */
.file-type-badge {
  background: var(--primary-color);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  margin-right: 8px;
}

.file-size {
  color: var(--text-light);
  font-size: 11px;
}

.attachment-details {
  display: flex;
  align-items: center;
  margin: 5px 0;
}

/* 预览样式 */
.preview-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.file-info {
  display: flex;
  gap: 15px;
  margin-top: 5px;
}

.file-info span {
  background: var(--bg-light);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.preview-content {
  max-height: 70vh;
  overflow: auto;
}

.office-preview,
.fallback-preview {
  text-align: center;
  padding: 40px 20px;
}

.file-icon-large {
  font-size: 48px;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.preview-actions {
  margin: 20px 0;
}

.preview-download-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.preview-download-btn:hover {
  background: var(--primary-dark);
}

.preview-note {
  color: var(--text-light);
  font-size: 12px;
  margin-top: 15px;
}

.text-preview {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 15px;
}

.text-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  overflow: auto;
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 13px;
}
/* 响应式设计 */
@media (max-width: 768px) {
  .modal-content {
    width: 85%;
  }
}
