:root {
  /* Dark Theme (Default) */
  --bg-primary: #1c1c24;
  --bg-secondary: #2b2b36;
  --bg-card: #2b2b36;
  --bg-input: #3a3a48;
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0b0;
  --accent: #ff4f66;
  --border-color: #3a3a48;
}

/* Light Theme */
body.light-theme {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #e0e0e0;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --accent: #ff4f66;
  --border-color: #d0d0d0;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.header-text h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header-text p {
  margin: 5px 0 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.header-right {
  display: flex;
  align-items: center;
}

.theme-btn {
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s;
  color: var(--text-primary);
}

.theme-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 79, 102, 0.3);
}

h2 {
  margin: 0 0 20px 0;
  font-size: 1.4rem;
  color: var(--text-primary);
  font-weight: 600;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.widget-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 25px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.widget-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  border-color: var(--accent);
}

body.light-theme .widget-card:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.widget-card h2 {
  margin: 0 0 10px 0;
  font-size: 1.3rem;
  color: var(--text-primary);
  border: none;
  padding: 0;
}

.widget-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  flex-grow: 1;
  line-height: 1.5;
}

.saved-widget {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 25px;
  border: 2px solid var(--border-color);
  grid-column: 1 / -1;
}

.saved-widget .card-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.saved-widget h2 {
  margin: 0 0 5px 0;
  font-size: 1.3rem;
}

.saved-widget > p {
  margin: 0 0 15px 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.saved-actions {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.action-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s;
}

.load-btn {
  background: var(--accent);
  color: white;
}

.load-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.delete-btn {
  background: var(--bg-input);
  color: #ff6b6b;
  border: 1px solid var(--border-color);
}

.delete-btn:hover {
  background: #ff6b6b;
  color: white;
}

.floating-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 64px;
  height: 64px;
  opacity: 0.5;
  pointer-events: none;
  z-index: 1000;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

body.light-theme .floating-icon {
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.loading {
  color: var(--text-secondary);
  text-align: center;
  grid-column: 1 / -1;
  padding: 40px;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  
  .header-left {
    flex-direction: column;
    width: 100%;
  }
  
  .header-right {
    width: 100%;
    justify-content: center;
  }
  
  .header-icon {
    width: 80px;
    height: 80px;
  }
  
  .header-text h1 {
    font-size: 1.8rem;
  }
}