/**
 * WhyRent - Dashboard Styles
 * Custom CSS for dashboard pages
 */

/* Dashboard Layout */
.dashboard-container {
  display: flex;
  min-height: 100vh;
  background-color: #f9fafb;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 260px;
  background-color: #ffffff;
  border-right: 1px solid #e5e7eb;
  z-index: 30;
  overflow-x: hidden;
  overflow-y: auto;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-collapsed {
  width: 80px;
}

.sidebar-logo {
  color: #7c3aed;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  transition: margin-left 0.3s ease;
  padding-top: 4rem;
  padding-bottom: 3rem;
}

.main-content-sidebar-collapsed {
  margin-left: 80px;
}

/* Dashboard Header */
.dashboard-header {
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Cards */
.card {
  background-color: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Custom Scrollbar */
.custom-scrollbar {
  max-height: 400px;
  overflow-y: auto;
}

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

.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #c5c5c5;
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Dropdown Menus */
.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  width: 300px;
  max-height: 400px;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 0.375rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 50;
  display: none;
}

/* Sort Dropdown Specific Styles */
.sort-dropdown {
  position: relative;
}

.sort-dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  width: 200px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 50;
  display: none;
}

.sort-dropdown-menu.show {
  display: block;
}

/* Ensure filter items maintain proper spacing in desktop */
@media (min-width: 768px) {
  .filter-desktop-container {
    display: flex;
    align-items: center;
    gap: 1rem;
  }
  
  .filter-desktop-container > * {
    flex-shrink: 0;
  }
}

/* Modal z-index to appear above sidebar */
.modal, #rentalDetailsModal, [id*="modal"], [class*="modal"], [id*="Modal"], [class*="Modal"] {
  z-index: 9999 !important;
  pointer-events: auto !important;
}

/* Ensure modal overlays and containers also have proper z-index */
.modal-overlay, .bg-black.bg-opacity-50, .fixed.inset-0 {
  z-index: 9998 !important;
  pointer-events: auto !important;
}

/* Specific modal containers */
.modal .bg-white, .modal-container, [id*="modal"] .bg-white, [id*="Modal"] .bg-white {
  z-index: 10000 !important;
  pointer-events: auto !important;
  position: relative;
}

/* Ensure close buttons are always clickable */
.modal .close-modal-btn, .modal .modal-close, [id*="modal"] .close-modal-btn, [id*="Modal"] .close-modal-btn {
  z-index: 10001 !important;
  pointer-events: auto !important;
  cursor: pointer;
}

/* Notification Badge */
.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ef4444;
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
}

/* Rounded Button */
.rounded-button {
  border-radius: 0.5rem;
}

/* Dropdown Specific Styles */
.notification-dropdown {
  width: 320px;
  right: 0;
  z-index: 50;
}

.profile-dropdown {
  width: 240px;
  right: 0;
  z-index: 50;
}

/* Active Navigation */
.nav-item.active {
  background-color: #f3f4f6;
  border-left: 3px solid #7c3aed;
}

.nav-item.active .nav-link {
  color: #7c3aed;
}

/* Statistics Cards */
.stat-card {
  background-color: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.stat-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.5rem;
}

.stat-card-trend {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
}

.trend-up {
  color: #10b981;
}

.trend-down {
  color: #ef4444;
}

/* Charts */
.chart-container {
  width: 100%;
  height: 250px;
  margin-top: 1rem;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 1rem;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab:hover {
  color: #4b5563;
}

.tab.active {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
}

/* Buttons */
.btn-primary {
  background-color: #7c3aed;
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: #6d28d9;
}

.btn-secondary {
  background-color: #f3f4f6;
  color: #4b5563;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

/* Item Cards */
.item-card {
  background-color: #ffffff;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.item-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.item-card-content {
  padding: 1rem;
}

.item-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.item-card-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: #7c3aed;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge-available {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge-rented {
  background-color: #e0e7ff;
  color: #4338ca;
}

.status-badge-maintenance {
  background-color: #fef3c7;
  color: #92400e;
}

.status-badge-overdue {
  background-color: #fee2e2;
  color: #b91c1c;
}

/* Chat/Message UI */
.message-list {
  max-height: 400px;
  overflow-y: auto;
}

.message-item {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.message-item:last-child {
  border-bottom: none;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
}

.chat-input {
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
}

.message-bubble {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}

.message-outgoing {
  background-color: #7c3aed;
  color: #ffffff;
  border-bottom-right-radius: 0;
  align-self: flex-end;
}

.message-incoming {
  background-color: #f3f4f6;
  color: #4b5563;
  border-bottom-left-radius: 0;
  align-self: flex-start;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: #111827;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

/* Ratings */
.star-rating {
  display: flex;
  align-items: center;
}

.star-filled {
  color: #fbbf24;
}

.star-empty {
  color: #d1d5db;
}

/* Live Chat Widget */
.live-chat-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
}

.chat-toggle-button {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background-color: #7c3aed;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: background-color 0.2s;
}

.chat-toggle-button:hover {
  background-color: #6d28d9;
}

.chat-popup {
  position: absolute;
  bottom: 4.5rem;
  right: 0;
  width: 350px;
  height: 450px;
  background-color: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: none;
}

.chat-header {
  background-color: #7c3aed;
  color: #ffffff;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-close {
  cursor: pointer;
}

.chat-messages {
  padding: 1rem;
  height: 320px;
  overflow-y: auto;
}

.chat-input-container {
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
}

.chat-input {
  flex-grow: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  margin-right: 0.5rem;
}

.chat-send {
  background-color: #7c3aed;
  color: #ffffff;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sidebar {
    width: 80px;
  }
  
  .sidebar-expanded {
    width: 260px;
  }
  
  .main-content {
    margin-left: 80px;
  }
  
  .main-content-sidebar-expanded {
    margin-left: 260px;
  }
  
  .sidebar-text {
    display: none;
  }
  
  .sidebar-expanded .sidebar-text {
    display: inline;
  }
  
  .chat-popup {
    width: 300px;
  }
}

/* Desktop sidebar always expanded */
@media (min-width: 769px) {
  .sidebar {
    width: 260px !important;
  }
  
  .main-content {
    margin-left: 260px !important;
  }
  
  .sidebar-text {
    display: inline !important;
  }
  
  .sidebar-collapsed {
    width: 260px !important;
  }
  
  .main-content-sidebar-collapsed {
    margin-left: 260px !important;
  }
}

@media (max-width: 640px) {
  .main-content {
    margin-left: 0;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar-expanded {
    transform: translateX(0);
    width: 260px;
  }
  
  .chat-popup {
    width: 280px;
    right: 0;
  }
}