/**
 * Stock Notifications CSS
 * Styles for stock alerts, notifications, and related UI
 */

/* ==========================================
   Notification Icon in Navbar
   ========================================== */
.nav-notifications {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  text-decoration: none;
  padding: 8px;
  margin-right: 5px;
  transition: all 0.3s ease;
}

.nav-notifications:hover {
  color: #3f51b5;
}

.nav-notifications i {
  font-size: 20px;
}

.notification-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: notifPulse 2s infinite;
}

@keyframes notifPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ==========================================
   Notification Dropdown
   ========================================== */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: -10px;
  width: 340px;
  max-width: 90vw;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  z-index: 10001;
  overflow: hidden;
  animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 18px;
  background: linear-gradient(135deg, #3f51b5 0%, #5c6bc0 100%);
  color: white;
}

.notification-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-header .mark-all-read {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.notification-header .mark-all-read:hover {
  background: rgba(255,255,255,0.3);
}

.notification-list {
  max-height: 350px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.notification-item:hover {
  background: #f8f9ff;
}

.notification-item.unread {
  background: #f0f4ff;
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #3f51b5;
}

.notification-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-icon i {
  font-size: 16px;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-message {
  margin: 0 0 4px;
  font-size: 13px;
  color: #333;
  line-height: 1.4;
}

.notification-time {
  font-size: 11px;
  color: #999;
}

.stock-badge {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 8px;
}

.notification-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3f51b5;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s;
  flex-shrink: 0;
}

.notification-action:hover {
  background: #303f9f;
  transform: scale(1.1);
}

.notification-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: #ccc;
  cursor: pointer;
  display: none;
  font-size: 12px;
}

.notification-item:hover .notification-dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-dismiss:hover {
  color: #ff5252;
}

.notification-empty {
  padding: 40px 20px;
  text-align: center;
  color: #999;
}

.notification-empty i {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.notification-empty p {
  margin: 0;
  font-size: 14px;
}

.clear-all-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border: none;
  background: #f5f5f5;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-all-btn:hover {
  background: #eeeeee;
  color: #333;
}

/* ==========================================
   Stock Toast Messages
   ========================================== */
.stock-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 99999;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90vw;
}

.stock-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.stock-toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  min-width: 300px;
}

.stock-toast.out-of-stock .stock-toast-content,
.stock-toast.taken-by-other .stock-toast-content {
  border-left: 4px solid #f44336;
}

.stock-toast.insufficient-stock .stock-toast-content {
  border-left: 4px solid #ff9800;
}

.stock-toast-content > i {
  font-size: 24px;
  flex-shrink: 0;
}

.stock-toast.out-of-stock i,
.stock-toast.taken-by-other i {
  color: #f44336;
}

.stock-toast.insufficient-stock i {
  color: #ff9800;
}

.stock-toast-text {
  flex: 1;
}

.stock-toast-text strong {
  display: block;
  font-size: 14px;
  color: #333;
  margin-bottom: 2px;
}

.stock-toast-text span {
  font-size: 13px;
  color: #666;
}

.notify-me-btn {
  background: linear-gradient(135deg, #3f51b5 0%, #5c6bc0 100%);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.notify-me-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(63, 81, 181, 0.4);
}

.notify-me-btn.added {
  background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
}

.notify-me-btn:disabled {
  cursor: default;
  transform: none;
}

.stock-toast-close {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 5px;
  font-size: 14px;
  flex-shrink: 0;
}

.stock-toast-close:hover {
  color: #333;
}

/* ==========================================
   Stock Issue Modal
   ========================================== */
.stock-issue-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

.stock-issue-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.stock-issue-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
}

.stock-issue-content {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: scale(0.9);
  transition: all 0.3s ease;
}

.stock-issue-modal.show .stock-issue-content {
  transform: scale(1);
}

.stock-issue-header {
  text-align: center;
  margin-bottom: 16px;
}

.stock-issue-header i {
  font-size: 48px;
  color: #ff9800;
  margin-bottom: 10px;
}

.stock-issue-header h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.stock-issue-modal p {
  text-align: center;
  color: #666;
  margin-bottom: 16px;
}

.stock-issue-items {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
}

.stock-issue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
}

.stock-issue-item:last-child {
  border-bottom: none;
}

.item-name {
  font-weight: 600;
  color: #333;
}

.item-stock {
  font-size: 12px;
  color: #666;
}

.item-stock strong {
  color: #f44336;
}

.stock-issue-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stock-issue-actions button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-adjust {
  background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
  color: white;
}

.btn-adjust:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-remove {
  background: #f5f5f5;
  color: #f44336;
}

.btn-remove:hover {
  background: #ffebee;
}

/* ==========================================
   Mobile Responsiveness
   ========================================== */
@media (max-width: 768px) {
  .notification-dropdown {
    width: 300px;
    right: -50px;
  }
  
  .stock-toast-content {
    flex-wrap: wrap;
    min-width: unset;
    padding: 14px;
  }
  
  .stock-toast-text {
    flex-basis: calc(100% - 50px);
  }
  
  .notify-me-btn {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
  }
  
  .stock-toast-close {
    position: absolute;
    top: 10px;
    right: 10px;
  }
}

/* ==========================================
   Dark Mode Support
   ========================================== */
[data-theme="dark"] .notification-dropdown,
.dark-mode .notification-dropdown {
  background: #1e1e1e;
}

[data-theme="dark"] .notification-item,
.dark-mode .notification-item {
  border-bottom-color: #333;
}

[data-theme="dark"] .notification-item:hover,
.dark-mode .notification-item:hover {
  background: #2a2a2a;
}

[data-theme="dark"] .notification-item.unread,
.dark-mode .notification-item.unread {
  background: #252535;
}

[data-theme="dark"] .notification-message,
.dark-mode .notification-message {
  color: #e0e0e0;
}

[data-theme="dark"] .stock-toast-content,
.dark-mode .stock-toast-content {
  background: #1e1e1e;
}

[data-theme="dark"] .stock-toast-text strong,
.dark-mode .stock-toast-text strong {
  color: #e0e0e0;
}

[data-theme="dark"] .stock-toast-text span,
.dark-mode .stock-toast-text span {
  color: #aaa;
}

[data-theme="dark"] .stock-issue-content,
.dark-mode .stock-issue-content {
  background: #1e1e1e;
}

[data-theme="dark"] .stock-issue-header h3,
.dark-mode .stock-issue-header h3 {
  color: #e0e0e0;
}

[data-theme="dark"] .stock-issue-items,
.dark-mode .stock-issue-items {
  background: #2a2a2a;
}
