/* ============================================
   Rosheta AI — Notification Dropdown Panel
   Responsive + RTL-safe (logical properties)
   ============================================ */

/* Notification Dropdown Container */
.notif-wrapper {
  position: relative;
  display: inline-flex;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: min(380px, 92vw);
  max-height: min(480px, calc(100dvh - 7rem));
  background: var(--glass-bg, rgba(255, 255, 255, 0.92));
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border, rgba(226, 232, 240, 0.7));
  border-radius: var(--radius-xl, 20px);
  box-shadow: var(--shadow-xl, 0 16px 48px rgba(15, 23, 42, 0.14));
  z-index: 300;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: notifSlideIn 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

[dir="ltr"] .notif-dropdown {
  inset-inline-end: 0;
  inset-inline-start: auto;
}

.notif-dropdown.open {
  display: flex;
}

@keyframes notifSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Notification Dropdown Header */
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm, 0.5rem);
  padding: var(--space-md, 1rem) var(--space-lg, 1.5rem);
  border-bottom: 1px solid var(--gray-100, #F1F5F9);
  flex-shrink: 0;
}

[data-theme="dark"] .notif-dropdown-header {
  border-color: var(--dark-border, #26334A);
}

.notif-dropdown-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800, #1E293B);
}

[data-theme="dark"] .notif-dropdown-header h3 {
  color: var(--gray-100, #F1F5F9);
}

.notif-mark-all-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-500, #2563EB);
  background: var(--primary-50, #EFF6FF);
  border: none;
  padding: 4px 12px;
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
  transition: background var(--t-fast, 140ms ease), color var(--t-fast, 140ms ease);
  white-space: nowrap;
}

.notif-mark-all-btn:hover {
  background: var(--primary-100, #DBEAFE);
  color: var(--primary-700, #1E40AF);
}

.notif-mark-all-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Notification List */
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xs, 0.25rem);
  min-height: 0;
}

.notif-list::-webkit-scrollbar {
  width: 3px;
}

.notif-list::-webkit-scrollbar-thumb {
  background: var(--gray-300, #CBD5E1);
  border-radius: var(--radius-full, 9999px);
}

/* Notification Item */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: var(--space-md, 1rem);
  border-radius: var(--radius-md, 12px);
  cursor: pointer;
  transition: background var(--t-fast, 140ms ease), border-color var(--t-fast, 140ms ease);
  margin-bottom: 2px;
  position: relative;
  border: 1px solid transparent;
  min-width: 0;
}

.notif-item:hover {
  background: var(--primary-50, #EFF6FF);
  border-color: var(--primary-100, #DBEAFE);
}

[data-theme="dark"] .notif-item:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.15);
}

.notif-item.unread {
  background: var(--primary-50, #EFF6FF);
  border-color: var(--primary-100, #DBEAFE);
}

[data-theme="dark"] .notif-item.unread {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.1);
}

.notif-item.unread::before {
  content: '';
  position: absolute;
  top: 50%;
  inset-inline-end: 8px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-500, #2563EB);
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.3);
}

/* Notification Icon */
.notif-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full, 9999px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.notif-item-icon.appointment {
  background: linear-gradient(135deg, var(--primary-100, #DBEAFE), var(--primary-200, #BFDBFE));
  color: var(--primary-600, #1D4ED8);
}

.notif-item-icon.message {
  background: linear-gradient(135deg, var(--info-light, #DBEAFE), #BFDBFE);
  color: var(--info, #2563EB);
}

.notif-item-icon.lab_result {
  background: linear-gradient(135deg, var(--success-light, #D1FAE5), #A7F3D0);
  color: var(--success, #059669);
}

.notif-item-icon.prescription {
  background: linear-gradient(135deg, var(--warning-light, #FEF3C7), #FDE68A);
  color: var(--warning-dark, #B45309);
}

[data-theme="dark"] .notif-item-icon.appointment {
  background: rgba(37, 99, 235, 0.2);
}

[data-theme="dark"] .notif-item-icon.message {
  background: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .notif-item-icon.lab_result {
  background: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .notif-item-icon.prescription {
  background: rgba(245, 158, 11, 0.2);
}

/* Notification Content */
.notif-item-content {
  flex: 1;
  min-width: 0;
}

.notif-item-message {
  font-size: 0.85rem;
  color: var(--gray-700, #334155);
  line-height: 1.5;
  margin-bottom: 2px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

[data-theme="dark"] .notif-item-message {
  color: var(--gray-200, #E2E8F0);
}

.notif-item-time {
  font-size: 0.7rem;
  color: var(--gray-400, #94A3B8);
  font-weight: 500;
  direction: ltr;
  display: inline-block;
}

/* Notification Mark Read Button */
.notif-mark-read {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full, 9999px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid var(--gray-200, #E2E8F0);
  color: var(--gray-400, #94A3B8);
  cursor: pointer;
  transition: background var(--t-fast, 140ms ease), border-color var(--t-fast, 140ms ease), color var(--t-fast, 140ms ease);
  flex-shrink: 0;
  opacity: 0;
  margin-top: 4px;
}

.notif-item:hover .notif-mark-read {
  opacity: 1;
}

.notif-mark-read:hover {
  background: var(--primary-50, #EFF6FF);
  border-color: var(--primary-300, #93C5FD);
  color: var(--primary-500, #2563EB);
}

[data-theme="dark"] .notif-mark-read:hover {
  background: rgba(37, 99, 235, 0.15);
  border-color: var(--primary-400, #60A5FA);
}

/* Notification Empty State */
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl, 3rem) var(--space-lg, 1.5rem);
  text-align: center;
}

.notif-empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-sm, 0.5rem);
  opacity: 0.4;
}

.notif-empty h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-500, #64748B);
  margin-bottom: 4px;
}

[data-theme="dark"] .notif-empty h4 {
  color: var(--gray-400, #94A3B8);
}

.notif-empty p {
  font-size: 0.8rem;
  color: var(--gray-400, #94A3B8);
}

/* Notification Badge on Bell */
.notif-badge-count {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full, 9999px);
  background: var(--error, #DC2626);
  color: var(--white, #fff);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white, #fff);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
  line-height: 1;
  direction: ltr;
}

[data-theme="dark"] .notif-badge-count {
  border-color: var(--dark-surface, #161F2E);
}

/* Notification Dot (hidden when count badge is shown) */
.notification-dot {
  display: none;
}

/* Toast Container */
.toast-container {
  position: fixed;
  top: var(--space-lg, 1.5rem);
  inset-inline-end: var(--space-lg, 1.5rem);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 0.5rem);
  pointer-events: none;
  width: min(92vw, 26rem);
}

/* Logout Confirmation Modal */
.logout-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: var(--space-lg, 1.5rem);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

.logout-modal-card {
  background: var(--white, #fff);
  border-radius: var(--radius-2xl, 24px);
  width: min(100%, 380px);
  padding: var(--space-2xl, 3rem) var(--space-lg, 1.5rem);
  box-shadow: var(--shadow-xl, 0 16px 48px rgba(15, 23, 42, 0.14));
  text-align: center;
  animation: fadeInUp 0.3s ease;
}

[data-theme="dark"] .logout-modal-card {
  background: var(--dark-surface, #161F2E);
}

.logout-modal-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md, 1rem);
}

.logout-modal-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800, #1E293B);
  margin-bottom: var(--space-xs, 0.25rem);
}

[data-theme="dark"] .logout-modal-card h3 {
  color: var(--gray-100, #F1F5F9);
}

.logout-modal-card p {
  font-size: 0.9rem;
  color: var(--gray-500, #64748B);
  margin-bottom: var(--space-xl, 2rem);
}

.logout-modal-actions {
  display: flex;
  gap: var(--space-sm, 0.5rem);
  justify-content: center;
  flex-wrap: wrap;
}

.logout-modal-actions .btn {
  min-width: 120px;
  flex: 1 1 auto;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive: mobile dropdown becomes fixed full-width sheet */
@media (max-width: 480px) {
  .notif-dropdown {
    position: fixed;
    top: 76px;
    inset-inline-start: var(--space-sm, 0.5rem);
    inset-inline-end: var(--space-sm, 0.5rem);
    width: auto;
    max-height: calc(100dvh - 120px);
    border-radius: var(--radius-lg, 16px);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

