.dark-mode {
  background-color: #111827;
}

.nav-item-wrapper {
  position: relative;
}

.notification-badge.active {
  display: flex !important;
}

/* Notification Badge */
.nav-item-wrapper {
  cursor: pointer;
  position: relative;
}

.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  margin-top: 12px;
  width: 360px;
  max-width: min(360px, calc(100vw - 32px));
  max-height: 80vh;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform-origin: top right;
  animation: dropdownSlideIn 0.2s ease-out forwards;
}

@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notification-actions {
  padding: 8px var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0 0 12px 12px;
}

@media (max-width: 1200px) {
  .notification-dropdown {
    position: fixed;
    top: 60px;
    left: 16px;
    right: 16px;
    width: auto;
    max-height: calc(100vh - 80px);
    overflow-y: hidden;
  }
}

@media (min-width: 1200px) {
  .notification-dropdown {
    right: 0;
    left: auto;
    max-width: min(360px, calc(100vw - 32px));
  }
}

.notification-badge {
  position: absolute;
  top: 0px;
  right: 5px;
  background: var(--brand-red, #ef4444);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  min-width: 20px;
  padding: 2px;
  box-sizing: border-box;
  z-index: 10;
}

.notification-badge.active {
  display: flex !important;
}

/* Notification Toast Container */
#notification-toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 768px) {
  #notification-toast-container {
    top: auto;
    bottom: 20px;
    right: 20px;
    left: 20px;
  }
}

.notification-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 300px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

[data-theme="dark"] .notification-toast {
  background: #1f2937;
  border-color: #374151;
}

.notification-toast .material-icons-outlined {
  color: var(--accent);
  font-size: 24px;
  flex-shrink: 0;
}

.notification-toast p {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  flex: 1;
}

.notification-toast a {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

.notification-toast a:hover {
  text-decoration: underline;
}

.notification-toast button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
}

.notification-toast button:hover {
  color: var(--text);
}

@media (max-width: 768px) {
  .container {
    max-width: 480px;
    padding: 20px 16px;
  }

  .card {
    padding: 20px;
    border-radius: 12px;
  }

  .notification-section {
    margin-bottom: 24px;
  }

  .notification-item-grid {
    display: flex;
    flex-direction: column;
  }

  .notification-item {
    padding: 14px;
    border-radius: 10px;
  }

  .notification-item-label {
    font-size: 14px;
  }

  .notification-item-description {
    font-size: 12px;
  }

  .toggle-switch {
    width: 40px;
    height: 22px;
    margin-left: 12px;
  }

  .toggle-slider:before {
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
  }

  .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
  }

  .quiet-section .quiet-hours-card {
    padding: 20px;
    border-radius: 12px;
  }

  .quiet-section .quiet-card-title {
    font-size: 15px;
    margin-bottom: 12px;
  }

  .quiet-section .quiet-time-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
  }

  .time-inputs {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 12px;
  }

  .time-inputs .time-label {
    font-size: 12px;
  }

  .time-inputs input[type="time"] {
    width: 100%;
    min-width: auto;
  }

  .form-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .btn-save,
  .btn-cancel {
    width: 100%;
  }
}

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

@media (min-width: 769px) {
  .card {
    padding: 40px;
  }
}

h2.notification-title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 32px;
  line-height: 1.2;
}

.notification-section {
  margin-bottom: 32px;
}

.notification-section:last-child {
  margin-bottom: 0;
}

.notification-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notification-section-title svg {
  width: 14px;
  height: 14px;
}

.notification-section-title svg {
  flex-shrink: 0;
}

.notification-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.notification-item:hover {
  border-color: #d1d5db;
}

.notification-item:last-child {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .notification-item-grid {
    display: flex;
    flex-direction: column;
  }
}

@media (min-width: 769px) {
  .notification-item-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .notification-item-grid .notification-item {
    margin-bottom: 0;
  }
}

.notification-item-content {
  flex: 1;
}

.notification-item-label {
  font-size: 15px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 4px;
}

.notification-item-description {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-left: 16px;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d1d5db;
  transition: all 0.2s ease;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: all 0.2s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent-button);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

input[type="time"] {
  font-family: inherit;
  color: inherit;
}

input[type="time"]::-webkit-datetime-edit {
  color: white;
}

input[type="time"]::-webkit-datetime-edit-fields-wrapper {
  background: transparent;
}

input[type="time"]::-webkit-datetime-edit-text {
  color: rgba(255, 255, 255, 0.7);
}

input[type="time"]::-webkit-datetime-edit-hour-field,
input[type="time"]::-webkit-datetime-edit-minute-field,
input[type="time"]::-webkit-datetime-edit-ampm-field {
  color: white;
}

[data-theme="dark"] .card {
  background: #1f2937;
  border-color: #374151;
}

[data-theme="dark"] h2.notification-title {
  color: #f9fafb;
}

[data-theme="dark"] .notification-section-title {
  color: #9ca3af;
}

[data-theme="dark"] .notification-section-title svg {
  stroke: #9ca3af;
}

[data-theme="dark"] .notification-item {
  background: #1f2937;
  border-color: #374151;
}

[data-theme="dark"] .notification-item:hover {
  border-color: #4b5563;
}

[data-theme="dark"] .notification-item-label {
  color: #f9fafb;
}

[data-theme="dark"] .notification-item-description {
  color: var(--accent);
}

[data-theme="dark"] .theme-toggle-btn {
  color: #f9fafb;
}

[data-theme="dark"] .theme-toggle-btn svg {
  stroke: #f9fafb;
}

[data-theme="dark"] .toggle-slider {
  background-color: #4b5563;
}

[data-theme="dark"] .btn-cancel {
  color: #9ca3af;
}

[data-theme="dark"] .btn-cancel:hover {
  background-color: #374151;
  color: #d1d5db;
}

[data-theme="dark"] .form-actions {
  border-top-color: #374151;
}

.quiet-section .quiet-hours-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  border: none;
  border-radius: 12px;
  padding: 24px;
  color: var(--text-on-accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (min-width: 769px) {
  .quiet-section .quiet-hours-card {
    padding: 32px;
  }

  .quiet-section .quiet-time-item {
    flex-direction: row;
    align-items: center;
  }

  .quiet-section .quiet-time-item .notification-item-content {
    flex: 1;
  }

  .quiet-section .time-inputs {
    flex-shrink: 0;
  }
}

.quiet-section .quiet-card-title {
  color: var(--text-on-accent);
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

.quiet-section .quiet-time-item {
  background: color-mix(in oklab, var(--text-on-accent) 15%, transparent);
  border-color: color-mix(in oklab, var(--text-on-accent) 25%, transparent);
  color: var(--text-on-accent);
  padding: 16px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.quiet-section .quiet-time-item:hover {
  background: color-mix(in oklab, var(--text-on-accent) 20%, transparent);
}

.quiet-section .quiet-time-item .item-label {
  color: var(--text-on-accent);
}

.quiet-section .quiet-time-item .item-description {
  color: color-mix(in oklab, var(--text-on-accent) 70%, transparent);
}

.quiet-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: color-mix(in oklab, var(--text-on-accent) 15%, transparent);
  border-radius: 6px;
  font-size: 13px;
  color: color-mix(in oklab, var(--text-on-accent) 80%, transparent);
}

.quiet-status.active {
  background: color-mix(in oklab, #22c55e 25%, transparent);
  color: #86efac;
}

.quiet-status .status-icon {
  font-size: 14px;
  width: 14px;
  height: 14px;
}

.quiet-status .status-text {
  font-size: 13px;
  font-weight: 500;
}

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

.time-inputs .time-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.time-inputs input[type="time"] {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  min-width: 100px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.time-inputs input[type="time"]:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

.time-inputs input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.6;
  cursor: pointer;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.btn-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: var(--accent-button);
  color: white;
}

.btn-save:hover {
  background-color: var(--accent-strong);
}

.btn-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: transparent;
  color: #6b7280;
  text-decoration: none;
}

.btn-cancel:hover {
  background-color: #f3f4f6;
  color: #374151;
  text-decoration: none;
}

.notification-content {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  flex: 1;
}

.notification-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.notification-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.notification-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.notification-message {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.notification-time {
  font-size: 12px;
  color: var(--muted);
}

.notice-row.unread {
  background: color-mix(in oklab, var(--accent) 10%, transparent);
  border-left: 3px solid var(--accent);
  padding-left: calc(var(--space-2) - 3px);
}

[data-theme="dark"] .notice-row.unread {
  background: color-mix(in oklab, var(--accent) 20%, transparent);
}

.notification-item.unread {
  background: color-mix(in oklab, var(--accent) 10%, transparent);
}

[data-theme="dark"] .notification-item.unread {
  background: color-mix(in oklab, var(--accent) 20%, transparent);
}

.notifications-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.notifications-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.notifications-title h1 {
  margin: 0;
}

.notifications-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.notifications-tray {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-2) 0;
}

.notification-summary {
  display: grid;
  gap: var(--space-3);
}

.notification-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.notification-summary-block {
  display: grid;
  gap: var(--space-1);
}

.notification-summary-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.notification-summary-tags {
  display: flex;
  flex-wrap: wrap;
}

.notification-recent {
  display: grid;
  gap: var(--space-2);
}

.notification-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.notification-list {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* Fix notification dropdown layout */
.notification-dropdown > #navbar-notification-tray,
.notification-dropdown > .notification-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  max-height: calc(80vh - 50px); /* Subtract actions height */
  margin: 0;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.notification-dropdown .notification-item {
  margin: 0;
}

.notification-list-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.notification-empty {
  margin-top: var(--space-2);
  padding: var(--space-4);
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius);
}

.notifications-page .notification-item {
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition:
    border-color var(--dur-base) var(--ease),
    background var(--dur-base) var(--ease);
}

.notifications-page .notification-item:hover {
  border-color: var(--border);
  background: var(--surface);
}

.notifications-page .notification-content {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.notifications-page .notification-icon {
  color: var(--accent);
  border-radius: 999px;
  padding: var(--space-2);
  background: color-mix(in oklab, var(--accent) 10%, transparent);
  font-size: 20px;
}

.notification-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

.notification-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.notification-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}

.notification-action .material-symbols-outlined {
  font-size: 10px;
}

@media (max-width: 768px) {
  .notifications-actions {
    width: 100%;
  }

  .notifications-actions .button,
  .notifications-actions form {
    width: 100%;
  }

  .notifications-actions form .button {
    width: 100%;
  }
}
