:root {
  /* Dark Mode Colors (Default) */
  --primary: #667eea;
  --primary-dark: #5568d3;
  --secondary: #764ba2;
  --accent: #f093fb;
  --success: #00d084;
  --danger: #ff6363;
  --warning: #ffa502;
  --bg: #0f172a;
  --bg-light: #1a2847;
  --bg-lighter: #2d3e5f;
  --card: #1e293b;
  --card-hover: #334155;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Colors */
[data-theme="light"] {
  --primary: #5568ce;
  --primary-dark: #4555b8;
  --secondary: #6b3fa0;
  --accent: #d946ef;
  --success: #10b981;
  --danger: #f43f5e;
  --warning: #fbbf24;
  --bg: #f9fafb;
  --bg-light: #f3f4f6;
  --bg-lighter: #e5e7eb;
  --card: #ffffff;
  --card-hover: #f3f4f6;
  --text: #1f2937;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(85, 104, 206, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-light) 50%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  transition: background 0.4s var(--transition);
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(240, 147, 251, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
  transition: background 0.4s var(--transition);
}

[data-theme="light"] body::before {
  background: radial-gradient(circle at 20% 50%, rgba(85, 104, 206, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(217, 70, 239, 0.08) 0%, transparent 50%);
}

.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 50px;
  animation: slideDown 0.8s ease;
  position: relative;
  z-index: 1;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
  position: relative;
}

.header-top > div:first-child {
  width: 40px;
}

.header-top > div:last-child {
  width: 40px;
}

.app-header h1 {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 50%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: -1px;
  text-shadow: 0 0 40px rgba(102, 126, 234, 0.2);
  flex: 1;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(102, 126, 234, 0.2);
  background: rgba(102, 126, 234, 0.1);
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--primary);
  background: rgba(102, 126, 234, 0.2);
  transform: scale(1.1) rotate(20deg);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon {
  display: block;
  transition: transform 0.4s var(--transition);
}

.theme-toggle:hover .theme-icon {
  transform: rotate(-20deg);
}

.subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.5px;
  margin: 0;
}

/* Panels */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  margin-bottom: 32px;
  animation: fadeIn 0.8s ease 0.2s both;
  border: 1px solid rgba(102, 126, 234, 0.1);
  position: relative;
  overflow: hidden;
  transition: background-color 0.4s var(--transition);
}

.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
}

.form-panel {
  background: linear-gradient(135deg, var(--card) 0%, rgba(45, 62, 95, 0.5) 100%);
}

.form-panel:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* Form Styles */
.row {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}

label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="date"],
input[type="text"],
select,
textarea {
  padding: 14px 16px;
  border: 2px solid var(--bg-lighter);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--bg-light);
  color: var(--text);
}

input[type="date"]::placeholder,
input[type="text"]::placeholder,
textarea::placeholder,
select option {
  color: var(--text-muted);
}

input[type="date"]:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15),
    inset 0 0 0 1px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

/* Buttons */
.actions {
  display: flex;
  gap: 14px;
  margin-top: 28px;
}

button {
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  position: relative;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#saveBtn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  flex: 1;
  box-shadow: var(--shadow-md), 0 0 20px rgba(102, 126, 234, 0.3);
}

#saveBtn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(102, 126, 234, 0.5);
}

#saveBtn:active {
  transform: translateY(-1px);
}

#clearBtn {
  background: var(--bg-lighter);
  color: var(--text-secondary);
  min-width: 120px;
  border: 2px solid var(--bg-lighter);
}

#clearBtn:hover {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 10px 14px;
  font-size: 0.85rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.btn-sm.edit {
  background: rgba(102, 126, 234, 0.2);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-sm.edit:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-sm.delete {
  background: rgba(255, 99, 99, 0.2);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-sm.delete:hover {
  background: var(--danger);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 99, 99, 0.3);
}

/* List Panel */
.list-panel h2 {
  font-size: 2rem;
  margin-bottom: 24px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.entries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.entry {
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(102, 126, 234, 0.2);
  background: linear-gradient(135deg, var(--bg-light) 0%, rgba(45, 62, 95, 0.3) 100%);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  animation: slideUp 0.6s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.entry::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(240, 147, 251, 0.1) 0%, transparent 70%);
  transition: all 0.6s ease;
}

.entry:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-8px);
}

.entry:hover::before {
  top: -25%;
  right: -25%;
}

.entry-header {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.mood-emoji {
  font-size: 2.5rem;
  flex-shrink: 0;
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.entry-title {
  flex: 1;
}

.entry-title h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 700;
}

.meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.entry-body {
  margin: 14px 0;
  font-size: 0.95rem;
  flex: 1;
  position: relative;
  z-index: 1;
}

.activity {
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity::before {
  content: '⚡';
}

.activity strong {
  color: var(--text);
  font-weight: 700;
}

.note {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(240, 147, 251, 0.1) 100%);
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 10px;
  border-left: 4px solid var(--primary);
  font-style: italic;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(102, 126, 234, 0.15);
  position: relative;
  z-index: 1;
}

/* Empty State */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.empty::before {
  content: '📝';
  display: block;
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
  animation: float 3s ease infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

/* Notifications */
.notification {
  position: fixed;
  top: 30px;
  right: 30px;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  z-index: 1000;
  animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 400px;
  border-left: 4px solid;
}

.notification-success {
  background: linear-gradient(135deg, rgba(0, 208, 132, 0.2) 0%, rgba(0, 208, 132, 0.05) 100%);
  color: var(--success);
  border-left-color: var(--success);
}

.notification-error {
  background: linear-gradient(135deg, rgba(255, 99, 99, 0.2) 0%, rgba(255, 99, 99, 0.05) 100%);
  color: var(--danger);
  border-left-color: var(--danger);
}

.notification-info {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(102, 126, 234, 0.05) 100%);
  color: var(--primary);
  border-left-color: var(--primary);
}

.notification.fade-out {
  animation: slideOutRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeIn 0.3s ease;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  max-width: 450px;
  width: 90%;
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.modal p {
  margin-bottom: 24px;
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 12px 24px;
  border: 2px solid var(--bg-lighter);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition);
  background: var(--bg-light);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.95rem;
}

.modal-btn:hover {
  border-color: var(--primary);
  background: transparent;
  color: var(--primary);
  transform: translateY(-2px);
}

.modal-btn.danger {
  background: linear-gradient(135deg, rgba(255, 99, 99, 0.2) 0%, rgba(255, 99, 99, 0.05) 100%);
  border-color: var(--danger);
  color: var(--danger);
}

.modal-btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
  box-shadow: 0 5px 15px rgba(255, 99, 99, 0.3);
}

/* Footer */
.app-footer {
  text-align: center;
  margin-top: 50px;
  padding-top: 24px;
  border-top: 1px solid rgba(102, 126, 234, 0.15);
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.3px;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .app {
    padding: 24px 16px;
  }

  .app-header h1 {
    font-size: 2.8rem;
  }

  .panel {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  .app {
    padding: 20px 16px;
  }

  .app-header {
    margin-bottom: 40px;
  }

  .app-header h1 {
    font-size: 2.2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .panel {
    padding: 20px;
    margin-bottom: 24px;
  }

  label {
    font-size: 0.9rem;
  }

  input[type="date"],
  input[type="text"],
  select,
  textarea {
    padding: 12px 14px;
    font-size: 16px;
  }

  .actions {
    flex-direction: column-reverse;
    gap: 12px;
  }

  #saveBtn,
  #clearBtn {
    width: 100%;
  }

  .entries {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }

  .entry {
    padding: 16px;
  }

  .mood-emoji {
    font-size: 2rem;
  }

  .entry-title h3 {
    font-size: 1.05rem;
  }

  .notification {
    top: 20px;
    right: 20px;
    left: 20px;
    max-width: none;
  }

  .modal {
    width: 90%;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 16px 12px;
  }

  .app-header h1 {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .panel {
    padding: 16px;
    margin-bottom: 20px;
  }

  label {
    font-size: 0.85rem;
  }

  input[type="date"],
  input[type="text"],
  select,
  textarea {
    padding: 11px 12px;
    font-size: 16px;
  }

  #saveBtn,
  #clearBtn {
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  .list-panel h2 {
    font-size: 1.6rem;
  }

  .entries {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .entry {
    padding: 12px;
  }

  .mood-emoji {
    font-size: 1.8rem;
  }

  .entry-title h3 {
    font-size: 1rem;
  }

  .card-actions {
    gap: 8px;
  }

  .btn-sm {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .notification {
    top: 16px;
    right: 16px;
    left: 16px;
    padding: 14px 16px;
    font-size: 0.9rem;
  }

  .modal {
    width: 85%;
  }

  .modal p {
    font-size: 1rem;
  }

  .modal-btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .empty {
    padding: 40px 16px;
  }

  .empty::before {
    font-size: 3rem;
    margin-bottom: 12px;
  }
}
