/* Custom styles for Product Search System */

/* Floating Sidebar Styles */
.floating-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 16rem; /* 256px */
  background: #ECECEE;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 50;
  transition: transform 0.3s ease-in-out;
}

.main-content-with-sidebar {
  margin-left: 16rem; /* 256px */
  min-height: 100vh;
  width: calc(100% - 16rem); /* Ensure content takes remaining width */
  flex: 1;
}

/* Mobile responsive adjustments */
@media (max-width: 1024px) {
  .floating-sidebar {
    transform: translateX(-100%);
  }
  
  .floating-sidebar.open {
    transform: translateX(0);
  }
  
  .main-content-with-sidebar {
    margin-left: 0;
  }
}

/* Sidebar hover effects */
.sidebar-item {
  transition: all 0.2s ease-in-out;
}

.sidebar-item:hover {
  transform: translateX(4px);
}

/* RTL Support */
[dir="rtl"] {
  text-align: right;
}

[dir="ltr"] {
  text-align: left;
}

/* Custom animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

/* Loading spinner */
.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Custom button styles */
.btn-primary {
  background-color: #3b82f6;
  color: white;
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-secondary {
  background-color: #6b7280;
  color: white;
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: #374151;
}

.btn-success {
  background-color: #10b981;
  color: white;
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-danger:hover {
  background-color: #dc2626;
}

/* Card styles */
.card {
  background-color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 0.5rem;
  padding: 1.5rem;
}

/* Form styles */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  color: #374151;
  font-size: 0.875rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.form-input {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  appearance: none;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  color: #374151;
  line-height: 1.5;
  outline: none;
  transition: all 0.3s ease;
}

.form-input:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
}

.form-textarea {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  appearance: none;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  color: #374151;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  transition: all 0.3s ease;
}

.form-textarea:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
}

/* Alert styles */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  position: relative;
  margin-bottom: 1rem;
}

.alert-success {
  background-color: #d1fae5;
  border: 1px solid #10b981;
  color: #065f46;
}

.alert-error {
  background-color: #fee2e2;
  border: 1px solid #ef4444;
  color: #991b1b;
}

.alert-warning {
  background-color: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
}

.alert-info {
  background-color: #dbeafe;
  border: 1px solid #3b82f6;
  color: #1e40af;
}

/* Table styles */
.table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table th {
  padding: 0.75rem 1.5rem;
  background-color: #f9fafb;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e5e7eb;
}

.table td {
  padding: 1rem 1.5rem;
  white-space: nowrap;
  font-size: 0.875rem;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
}

.table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

.table tbody tr:hover {
  background-color: #f3f4f6;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

.status-active {
  background-color: #d1fae5;
  color: #065f46;
}

.status-inactive {
  background-color: #f3f4f6;
  color: #374151;
}

.status-suspended {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Role badges */
.role-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

.role-admin {
  background-color: #fef3c7;
  color: #92400e;
}

.role-employee {
  background-color: #dbeafe;
  color: #1e40af;
}

.role-researcher {
  background-color: #e0e7ff;
  color: #3730a3;
}

.role-shipping_staff {
  background-color: #f3e8ff;
  color: #6b21a8;
}

.role-shipping_agent {
  background-color: #ecfdf5;
  color: #065f46;
}

.role-customer {
  background-color: #f0f9ff;
  color: #0c4a6e;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

/* Pagination styles */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pagination button {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  background-color: white;
  color: #374151;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
  background-color: #f3f4f6;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button.active {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

/* Search and filter styles */
.search-container {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.filter-select {
  min-width: 150px;
}

/* Container improvements */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Card hover effects */
.card:hover {
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}

/* Button improvements */
.btn-primary:focus,
.btn-secondary:focus,
.btn-success:focus,
.btn-danger:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Form improvements */
.form-input:focus,
.form-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Table improvements */
.table tbody tr {
  transition: background-color 0.2s ease;
}

/* Modal improvements */
.modal-content {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Floating Toast Messages */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
}

.toast {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  margin-bottom: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  min-width: 300px;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  border-left: 4px solid;
  position: relative;
  overflow: hidden;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.hide {
  transform: translateX(100%);
  opacity: 0;
}

.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 13px;
  opacity: 0.8;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 4px;
  margin-left: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

/* Toast Types */
.toast-success {
  border-left-color: #10b981;
  color: #065f46;
}

.toast-success .toast-icon {
  background: #d1fae5;
  color: #10b981;
}

.toast-error {
  border-left-color: #ef4444;
  color: #991b1b;
}

.toast-error .toast-icon {
  background: #fee2e2;
  color: #ef4444;
}

.toast-warning {
  border-left-color: #f59e0b;
  color: #92400e;
}

.toast-warning .toast-icon {
  background: #fef3c7;
  color: #f59e0b;
}

.toast-info {
  border-left-color: #3b82f6;
  color: #1e40af;
}

.toast-info .toast-icon {
  background: #dbeafe;
  color: #3b82f6;
}

/* Progress Bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.toast-progress-bar {
  height: 100%;
  background: currentColor;
  opacity: 0.3;
  border-radius: 0 0 12px 12px;
  animation: progress 5s linear forwards;
}

@keyframes progress {
  from { width: 100%; }
  to { width: 0%; }
}

/* Responsive Design */
@media (max-width: 640px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .toast {
    min-width: auto;
    width: 100%;
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .search-container {
    flex-direction: column;
  }
  
  .search-input,
  .filter-select {
    min-width: 100%;
  }
  
  .table {
    font-size: 0.75rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem;
  }
  
  .modal-content {
    margin: 1rem;
    width: calc(100% - 2rem);
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .card {
    padding: 1rem;
  }
  
  .table th,
  .table td {
    padding: 0.25rem;
    font-size: 0.75rem;
  }
}

/* Enhanced Sidebar Styles */
.sidebar-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
  transform: translateX(4px);
}

/* Top Bar Styles */
.top-bar {
  background: #ECECEE;
  color: #374151;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Content Background */
.content-background {
  background: #F2F2F4;
  min-height: 100vh;
}

/* Sidebar Text Colors */
.sidebar-text {
  color: #374151;
}

.sidebar-text:hover {
  color: #1f2937;
}

/* Enhanced Card Styles */
.enhanced-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.enhanced-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* Product Offers Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none !important;
}

.modal.flex {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalSlideIn 0.3s ease-out;
  max-height: 95vh;
  overflow-y: auto;
  margin: 0.5rem;
  width: calc(100% - 1rem);
  height: calc(100% - 1rem);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Offer Card Styles */
.offer-card {
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.offer-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.offer-card.approved {
  border-color: #10b981;
  background: linear-gradient(135deg, #d1fae5 0%, #f0fdf4 100%);
}

.offer-card.rejected {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
}

.offer-card.pending {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
}

/* Status Badge Enhancements */
.status-badge {
  position: relative;
  overflow: hidden;
}

.status-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: badgeShimmer 2s infinite;
}

@keyframes badgeShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Action Button Styles */
.action-btn {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.action-btn:hover::before {
  width: 100%;
  height: 100%;
}

.action-btn:active {
  transform: scale(0.95);
}

/* Offer Information Grid */
.offer-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.offer-info-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.2s ease;
}

.offer-info-card:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* File Attachment Styles */
.file-attachment {
  display: inline-flex;
  align-items: center;
  background: rgba(107, 114, 128, 0.1);
  border: 1px solid rgba(107, 114, 128, 0.2);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  margin: 0.125rem;
  transition: all 0.2s ease;
}

.file-attachment:hover {
  background: rgba(107, 114, 128, 0.2);
  transform: translateY(-1px);
}

/* Rank Badge Styles */
.rank-badge {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: white;
  font-weight: bold;
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  animation: rankPulse 2s infinite;
}

@keyframes rankPulse {
  0%, 100% {
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  }
  50% {
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.5);
  }
}

/* Accepted Offers Section Styles */
.accepted-offer-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 2px solid #bbf7d0;
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.accepted-offer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #10b981, #059669);
}

.accepted-offer-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.15);
  border-color: #10b981;
}

.accepted-offer-badge {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  font-weight: bold;
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
  animation: acceptedPulse 2s infinite;
}

@keyframes acceptedPulse {
  0%, 100% {
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.5);
  }
}

.accepted-offer-info {
  background: white;
  border: 1px solid #d1fae5;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.accepted-offer-price {
  color: #059669;
  font-weight: bold;
  font-size: 1.1rem;
}

/* Full-screen Modal Styles */
.modal-overlay {
  display: flex;
  flex-direction: column;
}

.modal-overlay > div:first-child {
  flex-shrink: 0; /* Modal header */
}

.modal-overlay > div:last-child {
  flex: 1;
  overflow-y: auto; /* Modal content */
}

/* Responsive Modal */
@media (max-width: 768px) {
  .modal-overlay {
    margin: 0.25rem;
    width: calc(100% - 0.5rem);
    height: calc(100% - 0.5rem);
  }
  
  .offer-info-grid {
    grid-template-columns: 1fr;
  }
  
  .offer-info-card {
    padding: 0.75rem;
  }
}

@media (max-width: 640px) {
  .modal-overlay {
    margin: 0.125rem;
    width: calc(100% - 0.25rem);
    height: calc(100% - 0.25rem);
    padding: 0.5rem;
  }
  
  .offer-card {
    padding: 1rem;
  }
}