/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --sidebar-width: 72px;
  --card-bg: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.18);
  --card-hover-border: rgba(255, 255, 255, 0.32);
  --text-primary: rgba(255, 255, 255, 1);
  --text-secondary: rgba(255, 255, 255, 0.82);
  --text-dim: rgba(255, 255, 255, 0.62);
  --text-shadow: 0 1px 4px rgba(0,0,0,0.6), 0 0 12px rgba(0,0,0,0.3);
  --blur-amount: blur(10px);
  --radius-card: 20px;
  --sidebar-bg: rgba(255, 255, 255, 0.06);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC',
               'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ===== DYNAMIC BACKGROUND ===== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    135deg,
    #0d0d1a 0%,
    #1a1040 25%,
    #0f2a4a 50%,
    #1a2a0d 75%,
    #2a0d1a 100%
  );
  background-size: 400% 400%;
  animation: gradientDrift 25s ease infinite;
}

.bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(99, 60, 180, 0.25) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(20, 90, 160, 0.20) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 10%, rgba(180, 80, 60, 0.15) 0%, transparent 50%);
  animation: auroraShift 18s ease-in-out infinite alternate;
}

@keyframes gradientDrift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes auroraShift {
  0%   { opacity: 0.6; transform: scale(1) rotate(0deg); }
  50%  { opacity: 1;   transform: scale(1.05) rotate(1deg); }
  100% { opacity: 0.7; transform: scale(0.98) rotate(-1deg); }
}

/* Ken Burns for image wallpaper */
@keyframes kenBurns {
  0%   { transform: scale(1) translate(0, 0); }
  50%  { transform: scale(1.08) translate(-1%, -1%); }
  100% { transform: scale(1) translate(0, 0); }
}

/* ===== APP SHELL ===== */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  background: var(--sidebar-bg);
  backdrop-filter: var(--blur-amount);
  -webkit-backdrop-filter: var(--blur-amount);
  border-right: 1px solid var(--card-border);
  z-index: 10;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(120, 80, 200, 0.8), rgba(60, 120, 200, 0.8));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border: 1.5px solid rgba(255,255,255,0.2);
  transition: transform 0.2s, border-color 0.2s;
}

.avatar:hover {
  transform: scale(1.05);
  border-color: rgba(255,255,255,0.4);
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  flex: 1;
}

.sidebar-bottom {
  margin-top: auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  width: 100%;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 32px;
  background: #fff;
  border-radius: 0 4px 4px 0;
}

.nav-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.nav-item:not(.active):hover .nav-icon {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.nav-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.nav-item.active .nav-label {
  color: var(--text-secondary);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 36px 40px 24px;
  scrollbar-width: none;
}

.main-content::-webkit-scrollbar {
  display: none;
}

/* ===== TOP SECTION ===== */
.top-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  margin-bottom: 40px;
}

/* ===== CLOCK — iOS style ===== */
.clock-area {
  text-align: center;
  user-select: none;
}

.time {
  font-family: 'Inter', -apple-system, 'SF Pro Display', sans-serif;
  font-size: clamp(80px, 10vw, 120px);
  font-weight: 200;
  letter-spacing: -3px;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.1),
    0 4px 30px rgba(0,0,0,0.5);
}

/* Colon pulse */
.time-colon {
  display: inline-block;
  animation: colonPulse 1s step-start infinite;
  opacity: 1;
}

@keyframes colonPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

.date-line {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.80);
  letter-spacing: 1.5px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.3);
}

/* ===== SEARCH BAR ===== */
.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(580px, 88%);
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: var(--blur-amount);
  -webkit-backdrop-filter: var(--blur-amount);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50px;
  padding: 11px 18px;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.search-form:focus-within {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06),
              0 8px 32px rgba(0, 0, 0, 0.25);
}

.search-engine-badge {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-form input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14.5px;
  font-family: inherit;
  caret-color: rgba(255,255,255,0.8);
}

.search-form input::placeholder {
  color: var(--text-dim);
}

.search-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.search-btn:hover {
  color: var(--text-primary);
}

/* ===== WIDGET GRID ===== */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  align-content: start;
}

/* ===== CARD BASE ===== */
.card {
  background: var(--card-bg);
  backdrop-filter: var(--blur-amount);
  -webkit-backdrop-filter: var(--blur-amount);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 20px;
  text-shadow: var(--text-shadow);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card svg {
  text-shadow: none;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--card-hover-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* ===== CARD LOADING STATE ===== */
.card-loading {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 13px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: rgba(255,255,255,0.5);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== WEATHER CARD ===== */
.weather-card {
  min-height: 180px;
  grid-column: span 2;  /* 占两列，给 7 天预报足够空间 */
  text-shadow: 0 1px 6px rgba(0,0,0,0.9), 0 2px 16px rgba(0,0,0,0.7);
}

/* 窗口窄时退回单列 */
@media (max-width: 700px) {
  .weather-card { grid-column: span 1; }
}

.weather-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

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

.weather-location {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.weather-location svg {
  opacity: 0.7;
}

.weather-refresh {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.weather-refresh:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.08);
}

.weather-refresh.spinning svg {
  animation: spin 1s linear infinite;
}

.weather-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}

.weather-left {}

.weather-temp {
  font-size: 52px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

.weather-desc {
  font-size: 13.5px;
  color: var(--text-primary);
  margin-top: 6px;
}

.weather-hilo {
  font-size: 12px;
  color: var(--text-primary);
  margin-top: 3px;
}

.weather-icon-main {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

/* Forecast */
.weather-forecast {
  display: flex;
  justify-content: space-between;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.forecast-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.forecast-name {
  font-size: 11.5px;
  color: var(--text-primary);
  font-weight: 500;
}

.forecast-icon {
  font-size: 22px;
  line-height: 1;
}

.forecast-temps {
  font-size: 11px;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.6;
}

.forecast-temps .hi {
  color: var(--text-primary);
}

/* Error state */
.weather-error {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 120, 120, 0.8);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

.weather-error small {
  color: var(--text-dim);
  font-size: 11.5px;
}

/* Card footer label */
.card-label {
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.5px;
}

/* ===== RSS CARD ===== */
.rss-card {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (max-width: 700px) {
  .rss-card { grid-column: span 1; }
}

.rss-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.rss-title-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.rss-title-bar svg {
  color: rgba(246, 173, 85, 0.9);
}

.rss-updated {
  font-size: 11px;
  color: var(--text-dim);
}

.rss-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: none;
  margin: 0 -4px;
  padding: 0 4px;
}

.rss-list::-webkit-scrollbar {
  display: none;
}

.rss-item {
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.rss-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s;
}

.rss-title:hover {
  color: rgba(180, 210, 255, 1);
}

.rss-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rss-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  color: rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  flex-shrink: 0;
}

.rss-info {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rss-empty {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

.rss-empty small {
  font-size: 11.5px;
  color: rgba(255,255,255,0.25);
}
