/* Custom Bootstrap Styles for ДОМКОМ */

:root {
  --primary-color: rgb(0, 160, 225);
  --primary-blue: #2563eb;
  --primary-blue-light: #3b82f6;
  --primary-blue-dark: #1d4ed8;
  --secondary-blue: #1e40af;
  --accent-blue: #60a5fa;
  
  --success-green: #10b981;
  --success-green-light: #34d399;
  --warning-orange: #f59e0b;
  --danger-red: #ef4444;

  --manufacturing-blue: #3498DB;
  --manufactured-green-light: #34d399;
  --prepared-for-being-delivered-purple: #9B59B6;
  --delivering-orange: #F39C12;
  --delivered-green: #10b981;

  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;
  
  --border-gray: #e2e8f0;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.1);
  --shadow-heavy: rgba(0, 0, 0, 0.15);
  --shadow-blue: rgba(37, 99, 235, 0.1);
  
  --gradient-primary: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --gradient-primary-light: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  
  --header-height: 80px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Background Overlay */
.background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("/images/background.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  filter: blur(8px) brightness(0.75) saturate(75%);
  transform: scale(1.05);
  z-index: -1;
}

/* Container width limitation */
.container-fluid {
  max-width: 1200px !important;
  margin: 0 auto;
}

/* Fix content padding to prevent overlap with header */
main.container-fluid {
  padding-top: 120px !important;
}

/* Navbar Customization */
.navbar {
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.navbar .container-fluid {
  max-width: 1200px;
  margin: 0 auto;
}

.navbar-brand img {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Duplicate Order Header */
.duplicate-order-header {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-gray);
  padding: 1rem;
  z-index: 999;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-width: 1100px;
  margin: 0 auto;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  width: 100%;
}

.duplicate-order-header.visible {
  transform: translateX(-50%) translateY(0);
}

/* Statistics Cards */
.stat-card {
  transition: var(--transition);
  border-radius: var(--border-radius-lg);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.stat-icon {
  transition: var(--transition);
}

.stat-card:hover .stat-icon {
  transform: scale(1.1);
}

/* Orders List */
.orders-list {
  min-height: 200px;
}

.order {
  border: 1px solid var(--border-gray);
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
  background: white;
  transition: var(--transition);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.order:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  transform: translateY(-3px);
}

.order-header {
  padding: 1.5rem;
  cursor: pointer;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--border-gray);
  transition: var(--transition);
}

.order-header:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.order-header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.order-number {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.order-number-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.order-number-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.toggle-symbol {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-blue);
  transition: var(--transition);
}

.order.expanded .toggle-symbol {
  transform: rotate(180deg);
}

.order-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.order-info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

.order-status-row {
  display: flex;
  align-items: center;
  margin-top: 1rem; /* Добавляем отступ сверху для всех статусов */
}

.last-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem; 
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.last-status.manufacturing {
  background: rgba(52, 152, 219, 0.1);
  color: var(--manufacturing-blue);
}

.last-status.manufactured {
  background: rgba(52, 211, 153, 0.1);
  color: var(--manufactured-green-light);
}

.last-status.delivered {
  background: rgba(16, 185, 129, 0.1);
  color: var(--delivered-green);
}

.last-status.delivering {
  background: rgba(243, 156, 18, 0.1);
  color: var(--delivering-orange);
}

/* Delivery status colors */
.last-status.delivery-started {
  background: var(--primary-color);
  color: white;
}

.last-status.delivery-in-progress {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.last-status.delivery-completed {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  margin-top: 1rem; /* Добавляем отступ сверху */
}

/* Убираем дублирующий отступ для order-status-row, так как он уже есть в .last-status.delivery-completed */
.order-status-row .last-status.delivery-completed {
  margin-top: 0; /* Убираем дополнительный отступ, так как он уже есть в самом элементе */
}

.last-status.delivery-failed {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Order Details */
.order-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.order.expanded .order-details {
  max-height: none;
}

.order-details-inner {
  padding: 1.5rem;
}

.order-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-gray);
}

.order-info-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  color: var(--text-dark);
}

.feedback-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--primary-blue);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  transition: var(--transition);
}

.feedback-toggle-btn:hover {
  background: var(--primary-blue-dark);
  transform: translateY(-1px);
}

.order-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
}

.order-text {
  flex: 1;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--neutral-100);
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 500;
  color: var(--text-light);
}

.info-value {
  font-weight: 600;
  color: var(--text-dark);
}

.order-icon {
  flex-shrink: 0;
}

.order-icon img {
  width: 220px;
  height: 220px;
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--border-radius-sm);
}

.order-icon img:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Progress Bar for Status History */
.status-progress {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--neutral-50);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-gray);
}

.progress-bar-container {
  position: relative;
  height: 8px;
  background: var(--neutral-200);
  border-radius: 4px;
  margin: 1rem 0;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-blue) 0%, var(--success-green) 100%);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.status-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.timeline-item {
  background: white;
  padding: 1rem;
  border-radius: var(--border-radius-sm);
  text-align: left;
  width: 100%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-item.completed {
  background: var(--success-green);
  color: white;
}

.timeline-item.current {
  background: var(--primary-blue);
  color: white;
}

.timeline-item.pending {
  background: var(--neutral-300);
  color: var(--text-light);
}

/* Timeline item colors for manufacturing statuses */
.timeline-item.manufacturing {
  background: var(--manufacturing-blue);
  color: white;
}

.timeline-item.manufactured {
  background: var(--manufactured-green-light);
  color: white;
}

.timeline-item.delivered {
  background: var(--delivered-green);
  color: white;
}

/* Timeline item colors for delivery statuses */
.timeline-item.delivery-started {
  background: var(--primary-color);
  color: white;
}

.timeline-item.delivery-in-progress {
  background: #f59e0b;
  color: white;
}

.timeline-item.delivery-completed {
  background: #10b981;
  color: white;
}

.timeline-item.delivery-failed {
  background: #ef4444;
  color: white;
}

.timeline-item.default-status {
  background: var(--neutral-500);
  color: white;
}

.timeline-item .status-name {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  flex: 1;
}

.timeline-item .status-date {
  font-size: 0.8rem;
  opacity: 0.9;
  text-align: right;
  min-width: 120px;
}

/* Sections */
.section {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-blue);
  font-weight: 600;
  color: var(--text-dark);
}

.products-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.products-list li {
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-gray);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  position: relative;
}

.products-list li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-blue);
}

.products-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
  border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

.status-history {
  list-style: none;
  padding: 0;
  margin: 0;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: var(--neutral-50);
  border-radius: var(--border-radius-sm);
  border-left: 3px solid var(--primary-blue);
}

.status-datetime {
  font-size: 0.875rem;
  color: var(--text-light);
}

.status-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.status-label.delivered {
  background: rgba(16, 185, 129, 0.1);
  color: var(--delivered-green);
}

.status-label.manufacturing {
  background: rgba(52, 152, 219, 0.1);
  color: var(--manufacturing-blue);
}

.status-label.manufactured {
  background: rgba(52, 211, 153, 0.1);
  color: var(--manufactured-green-light);
}

.status-label.default-status {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-light);
}

/* Delivery status colors */
.status-label.delivery-started {
  background: var(--primary-color);
  color: white;
}

.status-label.delivery-in-progress {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.status-label.delivery-completed {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.status-label.delivery-failed {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* No Orders State */
.no-orders {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.no-orders i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Loading Spinner */
.loading-spinner {
  border: 3px solid var(--neutral-200);
  border-top: 3px solid var(--primary-blue);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Modal Customization */
.modal-content {
  border-radius: var(--border-radius-lg);
  border: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  border-bottom: 1px solid var(--border-gray);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.modal-footer {
  border-top: 1px solid var(--border-gray);
  background: var(--neutral-50);
}

/* Form Controls */
.form-control:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.btn-primary {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}

.btn-primary:hover {
  background: var(--primary-blue-dark);
  border-color: var(--primary-blue-dark);
}

/* Image Upload */
.border-dashed {
  border-style: dashed !important;
  transition: var(--transition);
}

.border-dashed:hover {
  border-color: var(--primary-blue) !important;
  background: rgba(37, 99, 235, 0.05);
}

.image-preview {
  position: relative;
  display: inline-block;
  margin: 0.5rem;
}

.image-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--border-gray);
}

.remove-image {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 24px;
  height: 24px;
  background: var(--danger-red);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.remove-image:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  max-width: 300px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.notification.show {
  transform: translateX(0);
}

/* Responsive Design */
@media (max-width: 768px) {
  /* Дублирующий хедер для мобильных устройств - сдвигаем выше на высоту главного хедера */
  .duplicate-order-header {
    top: 0; /* Сдвигаем к самому верху экрана */
    background: rgba(255, 255, 255, 0.85); /* Делаем более прозрачным */
    backdrop-filter: blur(15px);
    padding: 0.75rem 1rem;
    border-radius: 0 0 12px 12px;
  }
  
  .order-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .order-info-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .status-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .navbar-brand {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .navbar-brand img {
    margin-bottom: 0.5rem;
  }
  
  .status-timeline {
    flex-direction: column;
    gap: 1rem;
  }
  
  .timeline-item {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
  
  .timeline-item .status-date {
    text-align: center;
    min-width: auto;
  }
  
  /* Компактный дизайн для stat-card на мобильных */
  .stat-card {
    height: auto;
    min-height: 80px;
    padding: 1rem;
    margin-bottom: 0.75rem;
  }
  
  .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  }
}

@media (max-width: 576px) {
  .order-header {
    padding: 1rem;
  }
  
  .order-details-inner {
    padding: 1rem 0.5rem;
  }
  
  .modal-dialog {
    margin: 1rem;
  }
  
  /* Дополнительные исправления для очень маленьких экранов */
  .duplicate-order-header {
    width: calc(100% - 1rem);
    padding: 0.5rem 0.75rem;
    border-radius: 0 0 8px 8px;
  }
  
  .last-status {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
  
  /* Еще более компактный дизайн для очень маленьких экранов */
  .stat-card {
    min-height: 70px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
  }
}

/* Step Indicator */
.step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-gray);
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--primary-blue);
  transform: scale(1.2);
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in {
  animation: slideIn 0.4s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Footer Customization */
footer {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
  color: #f8fafc !important;
}

footer h5,
footer p,
footer a,
footer span {
  color: #f8fafc !important;
}

footer a:hover {
  color: var(--primary-blue-light) !important;
}

/* Utility Classes */
.text-primary {
  color: var(--primary-blue) !important;
}

.bg-primary {
  background: var(--primary-blue) !important;
}

.border-primary {
  border-color: var(--primary-blue) !important;
}

.btn-outline-primary {
  color: var(--primary-blue);
  border-color: var(--primary-blue);
}

.btn-outline-primary:hover {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}
