:root {
  --bg-color: #f9f7f2;
  --panel-bg: rgba(255, 255, 255, 0.9);
  --panel-border: rgba(148, 163, 184, 0.2);
  --text-primary: #0b1220;
  --text-secondary: #334155;
  --text-muted: #526277;
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --accent-teal: #0f766e;
  --accent-teal-bg: rgba(15, 118, 110, 0.06);
  --accent-pink: #be185d;
  --user-msg-bg: linear-gradient(135deg, #1e40af 0%, #6d28d9 100%);
  --bot-msg-bg: rgba(255, 255, 255, 0.95);
  --font-sans: "Inter", sans-serif;
  --font-display: "Outfit", sans-serif;
  --font-serif: "Playfair Display", serif;
  --font-mono: "JetBrains Mono", monospace;
  --border-radius-lg: 28px;
  --border-radius-md: 20px;
  --border-radius-sm: 14px;
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 10px 24px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  background-image:
    radial-gradient(circle at 0% 0%, rgba(30, 64, 175, 0.08) 0%, transparent 34%),
    radial-gradient(circle at 100% 100%, rgba(109, 40, 217, 0.07) 0%, transparent 28%),
    linear-gradient(180deg, #fffdf8 0%, #f6f3ed 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 1300px;
  height: 90vh;
  min-height: 720px;
  margin: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.93), rgba(248, 248, 252, 0.9));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-card);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 28px rgba(30, 64, 175, 0.12);
  overflow: hidden;
}

.logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-title-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.brand-title-primary {
  color: var(--primary);
}

.brand-kicker {
  margin-top: 4px;
  color: #425066;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-description {
  margin-top: 8px;
  max-width: 520px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
  font-weight: 500;
}

.notification-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: #425066;
  background: rgba(250, 248, 244, 0.96);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 500;
}

.notification-banner i {
  color: var(--primary);
  animation: pulse 2s infinite;
}

.main-layout {
  display: flex;
  flex: 1;
  gap: 20px;
  height: calc(100% - 75px);
  min-height: 0;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(252, 251, 248, 0.9));
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  display: flex;
  flex-direction: column;
  padding: 24px;
  min-height: 0;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.calendar-panel {
  flex: 1.2;
}

.chat-panel {
  flex: 0.8;
}

.btn-primary {
  background: var(--user-msg-bg);
  color: #fff;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 12px 22px rgba(30, 64, 175, 0.18);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(30, 64, 175, 0.2);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 7px 10px;
  font-size: 0.72rem;
  border-radius: 999px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-secondary);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-sm);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s, border-color 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 1);
  color: var(--text-primary);
  border-color: rgba(30, 64, 175, 0.16);
  transform: translateY(-1px);
}

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

.calendar-header h2 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-style: italic;
  font-weight: 700;
  color: #18358c;
}

.calendar-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.weekdays-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 700;
  color: #44556d;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 10px;
  flex: 1;
  min-height: 280px;
}

.day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.12);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.day-cell:hover:not(.empty) {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(30, 64, 175, 0.16);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.day-cell.empty {
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: default;
}

.day-number {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.day-cell.today {
  background: var(--accent-teal-bg);
  border-color: rgba(15, 118, 110, 0.25);
  color: var(--accent-teal);
}

.day-cell.today .day-number {
  font-weight: 800;
}

.day-cell.selected-day {
  border-color: rgba(30, 64, 175, 0.24);
  box-shadow:
    0 12px 24px rgba(30, 64, 175, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.event-indicators {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 6px;
  margin-top: auto;
}

.event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6d28d9);
  animation: scaleUp 0.3s forwards;
}

.agenda-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agenda-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.agenda-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.badge {
  background: rgba(30, 64, 175, 0.08);
  color: #18358c;
  border: 1px solid rgba(30, 64, 175, 0.14);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}

.agenda-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 5px;
}

.agenda-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  padding: 12px 14px;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.agenda-item:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(30, 64, 175, 0.16);
  transform: translateY(-1px);
}

.agenda-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agenda-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.agenda-time {
  font-size: 0.72rem;
  color: #0d5f59;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.agenda-actions {
  display: flex;
  gap: 8px;
}

.btn-delete-event {
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
}

.btn-delete-event:hover {
  color: var(--accent-pink);
  background: rgba(190, 24, 93, 0.08);
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
  font-weight: 500;
  padding: 18px 0;
}

.chat-header {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  margin-bottom: 16px;
}

.bot-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-avatar {
  background: rgba(30, 64, 175, 0.08);
  color: var(--primary);
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(30, 64, 175, 0.12);
}

.bot-info h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.bot-info .status {
  font-size: 0.68rem;
  color: #4b5c73;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-teal);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.message {
  display: flex;
  max-width: 85%;
  animation: slideUp 0.3s ease-out forwards;
}

.message.bot {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
}

.message-content {
  padding: 13px 16px;
  border-radius: var(--border-radius-md);
  font-size: 0.94rem;
  line-height: 1.6;
  font-weight: 500;
}

.message.bot .message-content {
  background: var(--bot-msg-bg);
  color: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-card);
}

.message.bot ul {
  margin-top: 8px;
  padding-left: 20px;
}

.message.bot li {
  margin-bottom: 4px;
}

.message.user .message-content {
  background: var(--user-msg-bg);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.3s infinite both;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

.chat-input-area {
  display: flex;
  gap: 10px;
  background: rgba(250, 248, 244, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 8px;
  border-radius: var(--border-radius-md);
}

.chat-input-area input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 600;
  padding: 8px 12px;
}

.chat-input-area input::placeholder {
  color: #708197;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.36);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.5);
}

@media (max-width: 900px) {
  body {
    padding: 10px;
    align-items: flex-start;
  }

  .app-container {
    height: auto;
    min-height: 0;
    margin: 0;
    gap: 10px;
  }

  .main-layout {
    flex-direction: column;
    height: auto;
    gap: 15px;
  }

  .calendar-panel {
    height: auto;
    padding: 16px;
  }

  .days-grid {
    grid-auto-rows: minmax(45px, auto);
    min-height: 0;
  }

  .day-cell {
    aspect-ratio: 1.1 / 1;
    padding: 6px;
  }

  .day-number {
    font-size: 0.85rem;
  }

  .agenda-list {
    max-height: none;
  }

  .chat-panel {
    height: 580px;
    padding: 16px;
  }

  .notification-banner {
    font-size: 0.8rem;
  }
}

@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .notification-banner {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
}
