/**
 * Date Manager Styles
 * Sticky date bar and related components
 */

/* ========================================
   Sticky Date Bar
   ======================================== */

.sticky-date-bar {
  position: fixed;
  top: 80px; /* Match header height */
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 99; /* Below header (z-index: 1000) */
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

.sticky-date-bar.visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.sticky-date-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 48px;
}

.sticky-date-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.sticky-date-info {
  display: flex;
  align-items: center;
  gap: 16px;
  color: white;
  flex: 1;
  min-width: 0;
}

/* Days indicator in sticky bar */
.sticky-days-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.sticky-days-indicator .day-square {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.sticky-days-indicator .day-square.day-high {
  background-color: rgba(230, 224, 248, 0.7); /* Лавандовый - обычный день */
}

.sticky-days-indicator .day-square.day-low {
  background-color: #F97316; /* Оранжевый - скидочный день */
}

.sticky-days-indicator .day-more {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  margin-left: 4px;
}

.sticky-date-icon {
  flex-shrink: 0;
  color: white;
}

.sticky-date-text {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-date-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sticky-date-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sticky-date-edit {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(10px);
}

.sticky-date-edit:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.sticky-date-clear {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  padding: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticky-date-clear:hover {
  background: rgba(255, 77, 77, 0.8);
  transform: rotate(90deg);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .sticky-date-bar {
    top: 80px; /* Same as desktop - header is 80px */
  }

  .sticky-date-content {
    padding: 10px 16px;
    gap: 8px;
    position: relative;
    min-height: 44px;
  }

  .sticky-date-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
  }

  .sticky-date-main > .sticky-date-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
  }

  .sticky-date-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
  }

  .sticky-date-text {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .sticky-days-indicator {
    width: 100%;
    line-height: 1;
  }

  .sticky-days-indicator .day-square {
    width: 8px;
    height: 8px;
  }

  .sticky-date-actions {
    flex-shrink: 0;
  }

  .sticky-date-btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  .sticky-date-clear {
    width: 26px;
    height: 26px;
    padding: 4px;
  }
}

@media (max-width: 480px) {
  .sticky-date-bar {
    top: 80px; /* Header is always 80px */
  }

  .sticky-date-content {
    padding: 6px 12px;
    gap: 6px;
  }

  .sticky-date-text {
    font-size: 11px;
  }

  .sticky-date-info {
    gap: 4px;
  }

  .sticky-date-main > .sticky-date-icon {
    width: 24px;
    height: 24px;
  }

  .sticky-date-edit {
    padding: 4px 8px;
    font-size: 10px;
  }

  .sticky-date-clear {
    width: 24px;
    height: 24px;
  }

  .sticky-days-indicator .day-square {
    width: 6px;
    height: 6px;
  }

  .sticky-days-indicator .day-more {
    font-size: 10px;
  }
}

/* ========================================
   Price update animations
   ======================================== */

.car-price-value.updating,
.price-value.updating {
  animation: priceUpdate 0.5s ease;
}

@keyframes priceUpdate {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
    color: #667eea;
  }
}

/* ========================================
   Date selection highlight
   ======================================== */

.date-selected-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #667eea;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

/* ========================================
   Loading state for price calculations
   ======================================== */

.calculating-prices .car-price-value::after,
.calculating-prices .price-value::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid #667eea;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
