/* Стили для модальных окон аутентификации и оформления заказов */

/* Общие стили для модальных окон */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
  margin: auto;
}

/* Специальные стили для модального окна оформления заказа */
.checkout-modal-content,
.checkout-content {
  max-width: 1000px !important;
  width: 95% !important;
  min-height: 600px;
}

/* Специальные стили для модального окна профиля */
.profile-modal-content,
#profile-modal .modal-content {
  max-width: 900px !important;
  width: 95% !important;
  max-height: 90vh;
  min-height: 500px;
}

/* Стили для модального окна выбора региона */
.region-modal-content {
  max-width: 800px !important;
  width: 90% !important;
  max-height: 80vh;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.modal-body {
  padding: 24px;
}

/* Стили для форм */
.auth-form,
.profile-form,
.checkout-form,
.quick-order-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 500;
  color: #374151;
  font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* Кнопки */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

/* Ссылки в формах */
.auth-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  text-align: center;
}

.auth-links a {
  color: #3b82f6;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.auth-links a:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* Стили для профиля пользователя */
.profile-tabs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tab-buttons {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  gap: 0;
}

.tab-button {
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.2s;
}

.tab-button.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.tab-button:hover {
  color: #374151;
}

/* Исправляем конфликт с общими правилами tab-content из styles.css */
.profile-tabs .tab-content {
  display: block !important;
}

.profile-tabs .tab-content .tab-pane {
  display: none;
}

.profile-tabs .tab-content .tab-pane.active {
  display: block;
}

.profile-actions {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
}

/* Стили для заказов */
#orders-list {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

#orders-list::-webkit-scrollbar {
  width: 6px;
}

#orders-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

#orders-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

#orders-list::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.order-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s;
}

.order-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.order-number {
  font-weight: 600;
  color: #1f2937;
}

.order-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

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

.status-processing {
  background: #dbeafe;
  color: #1e40af;
}

.status-shipped {
  background: #e0e7ff;
  color: #5b21b6;
}

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

.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.order-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  color: #6b7280;
}

.order-items {
  margin-bottom: 12px;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
  gap: 12px;
}

.order-item .item-name {
  flex: 1;
  font-weight: 500;
  color: #374151;
}

.order-item .item-quantity {
  flex-shrink: 0;
  color: #6b7280;
  font-size: 13px;
}

.order-item .item-price {
  flex-shrink: 0;
  font-weight: 600;
  color: #1f2937;
  min-width: 80px;
  text-align: right;
}

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

.order-notes {
  margin-bottom: 12px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 14px;
}

.order-admin-comments {
  margin-bottom: 12px;
  padding: 12px;
  background: #eff6ff;
  border-radius: 6px;
  font-size: 14px;
}

.order-client-comments {
  margin-bottom: 12px;
  padding: 12px;
  background: #f0f9ff;
  border-radius: 6px;
  font-size: 14px;
  border-left: 3px solid #0ea5e9;
}

.admin-comment {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e7ff;
}

.admin-comment:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.admin-comment small {
  color: #6b7280;
  font-size: 12px;
}

.admin-comment p {
  margin: 4px 0 0 0;
  color: #374151;
}

.client-comment {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0f2fe;
}

.client-comment:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.client-comment small {
  color: #6b7280;
  font-size: 12px;
}

.client-comment p {
  margin: 4px 0 0 0;
  color: #374151;
}

.order-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.order-actions .btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Стили для модальных окон комментариев */
.comment-form {
  padding: 20px 0;
}

.comment-form .form-group {
  margin-bottom: 16px;
}

.comment-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #374151;
}

.comment-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
}

.comment-form textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Стили для истории заказов */
.order-history {
  max-height: 400px;
  overflow-y: auto;
  padding: 20px 0;
}

.history-entry {
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.history-entry:last-child {
  margin-bottom: 0;
}

.history-date {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.history-status {
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
}

.history-comment {
  padding: 8px 12px;
  background: #ffffff;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
  margin-bottom: 8px;
  font-size: 14px;
}

.history-admin-comment {
  padding: 8px 12px;
  background: #eff6ff;
  border-radius: 6px;
  border-left: 3px solid #1d4ed8;
  font-size: 14px;
}

.modal-actions {
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  text-align: right;
}

/* Улучшенные стили для профиля */
.profile-form .form-group {
  margin-bottom: 20px;
}

.profile-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #374151;
}

.profile-form input,
.profile-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.profile-form input:focus,
.profile-form textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.profile-form textarea {
  resize: vertical;
  min-height: 80px;
}

.no-orders {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.no-orders i {
  font-size: 48px;
  margin-bottom: 16px;
  color: #d1d5db;
}

.no-orders h3 {
  margin-bottom: 8px;
  color: #374151;
}

.error-message {
  text-align: center;
  padding: 40px 20px;
  color: #dc2626;
}

.error-message i {
  font-size: 48px;
  margin-bottom: 16px;
}

/* Стили для оформления заказа */
.checkout-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.checkout-left {
  background: #f9fafb;
  padding: 24px;
  border-radius: 8px;
}

.checkout-section {
  margin-bottom: 24px;
}

.checkout-section h4 {
  margin: 0 0 16px 0;
  color: #1f2937;
  font-size: 16px;
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Опции доставки и оплаты */
.shipping-options,
.payment-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shipping-option,
.payment-option {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.shipping-option:hover,
.payment-option:hover {
  border-color: #3b82f6;
  background: #f8fafc;
}

.shipping-option input[type="radio"],
.payment-option input[type="radio"] {
  margin-right: 12px;
}

.shipping-option label,
.payment-option label {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.option-title {
  font-weight: 600;
  color: #1f2937;
}

.option-price {
  font-weight: 500;
  color: #3b82f6;
}

.option-description {
  font-size: 14px;
  color: #6b7280;
}

.delivery-address {
  margin-top: 16px;
  padding: 16px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

/* Правая часть - сводка заказа */
.checkout-right {
  background: white;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  height: fit-content;
}

.order-summary h4 {
  margin: 0 0 16px 0;
  color: #1f2937;
}

.order-items {
  margin-bottom: 16px;
}

.checkout-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

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

.item-info {
  flex: 1;
}

.item-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.item-details {
  font-size: 14px;
  color: #6b7280;
}

.item-total {
  font-weight: 600;
  color: #1f2937;
}

.order-totals {
  padding-top: 16px;
  border-top: 2px solid #e5e7eb;
}

.total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.total-final {
  font-size: 18px;
  font-weight: 600;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  color: #1f2937;
}

.btn-place-order {
  width: 100%;
  margin-top: 20px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
}

/* Стили для успешного заказа */
.success-modal .modal-content {
  max-width: 600px;
}

.success-info {
  text-align: center;
  padding: 20px;
}

.success-icon {
  font-size: 64px;
  color: #10b981;
  margin-bottom: 20px;
}

.success-icon i {
  display: block;
}

.order-details {
  background: #f9fafb;
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
  text-align: left;
}

.order-details p {
  margin: 8px 0;
  display: flex;
  justify-content: space-between;
}

.success-message {
  color: #6b7280;
  margin: 16px 0;
  font-style: italic;
}

.success-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.success-actions .btn {
  min-width: 150px;
}

/* Уведомления */
.notifications-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10002;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.notifications-container .notification {
  pointer-events: all;
}

.notification {
  position: relative;
  max-width: 400px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  animation: notificationSlideIn 0.3s ease-out;
}

@keyframes notificationSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.notification-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 12px;
}

.notification-message {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.notification-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.notification-close:hover {
  opacity: 1;
}

.notification-success {
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid #10b981;
}

.notification-error {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.notification-warning {
  background: #fef3c7;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.notification-info {
  background: #dbeafe;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

/* Кнопка быстрого заказа в карточке товара */
.quick-order-btn {
  background: #f59e0b;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.quick-order-btn:hover {
  background: #d97706;
  transform: translateY(-1px);
}

/* Адаптивность */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .checkout-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .checkout-left {
    order: 2;
  }
  
  .product-info {
    flex-direction: column;
    text-align: center;
  }
  
  .tab-buttons {
    flex-wrap: wrap;
  }
  
  .notification {
    left: 20px;
    right: 20px;
    max-width: none;
  }
}

/* Стили для модального окна выбора региона */
.region-search {
  margin-bottom: 20px;
}

.region-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

.region-search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.regions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.region-column h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

.region-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.region-list li {
  margin-bottom: 4px;
}

.region-list a {
  display: block;
  padding: 8px 12px;
  color: #374151;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 14px;
}

.region-list a:hover {
  background: #f3f4f6;
  color: #3b82f6;
}

.region-list a:active {
  background: #e5e7eb;
}

/* Скрытие регионов при поиске */
.region-list li.hidden {
  display: none;
}

.notification {
  width: 90%;
  right: 5%;
}

/* Специальные стили для кнопки выхода */
.profile-actions .btn[data-action="logout"] {
  background: #dc2626;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.profile-actions .btn[data-action="logout"]:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.profile-actions .btn[data-action="logout"]:active {
  transform: translateY(0);
}

/* Стили для модального окна консультации */
.consultation-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.consultation-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.consultation-form .form-group label {
  font-weight: 500;
  color: #374151;
  font-size: 14px;
}

.consultation-form .form-group input,
.consultation-form .form-group textarea {
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  background: white;
}

.consultation-form .form-group input:focus,
.consultation-form .form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.consultation-form .form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.consultation-form .error-message {
  color: #dc2626;
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.consultation-form .error-message.show {
  display: block;
}

.consultation-form .form-group.error input,
.consultation-form .form-group.error textarea {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.consultation-form .form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

.consultation-form .btn-submit.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.consultation-form .btn-submit.loading::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
} 