/**
 * Base Popup Styles
 * 
 * Provides foundational styling for all popups in the system.
 * Based on Figma designs and WordPress theme architecture.
 */

/* CSS Custom Properties for Popup System */
/* Все переменные теперь определены в style.css */

/* Base Reset for Popup Elements */
.popup-overlay *,
.popup-overlay *::before,
.popup-overlay *::after {
  box-sizing: border-box;
}

/* Popup Overlay - Full Screen Background */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--popup-overlay-bg);
  backdrop-filter: var(--popup-backdrop-blur);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--popup-animation-duration) var(--popup-animation-easing);
  padding: 20px;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Popup Container - Main Content Wrapper */
.popup-container {
  max-width: var(--popup-max-width);
  width: 100%;
  max-height: var(--popup-max-height);
  background: var(--popup-bg);
  border-radius: var(--popup-border-radius);
  box-shadow: var(--popup-shadow);
  transform: scale(0.9) translateY(20px);
  transition: transform var(--popup-animation-duration) var(--popup-animation-easing);
  overflow: hidden;
  position: relative;
}

.popup-overlay.active .popup-container {
  transform: scale(1) translateY(0);
}

/* Popup Wrapper - Inner Structure */
.popup-wrapper {
  display: flex;
  flex-direction: column;
  row-gap: 8px;
  position: relative;
  z-index: 2;
}

/* Popup Header */
.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--popup-bg);
  padding: var(--popup-header-padding);
  border-radius: var(--popup-border-radius);
}

.popup-title {
  line-height: 1.5em; /* 36px */
  letter-spacing: 0;
  color: var(--color-black-100);
  font-family: 'Halvar Breitschrift', sans-serif;
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0;
  flex-shrink: 0;
}

.popup-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 41px;
  background: var(--color-white-100);
  padding: 12px;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}

.popup-close:hover {
  background-color: #f5f5f5;
}

.popup-close-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Popup Content Wrapper */
.popup-content-wrap {
  display: flex;
  flex-direction: column;
  background: var(--popup-bg);
  padding: 8px;
  border-radius: var(--popup-border-radius);
  max-height: 60vh;
  overflow-y: auto;
  row-gap: 8px;
}

/* Popup Content Body */
.popup-content {
  display: flex;
  flex-direction: column;
  background: var(--color-white-100);
  border-radius: 26px;
  padding: var(--popup-content-padding);
  row-gap: 16px;
}

/* Content Text Styles */
.popup-content p {
  margin: 0;
  line-height: 1.333em; /* 24px */
  letter-spacing: 0;
  color: var(--color-black-100);
  font-family: 'Gilroy', sans-serif;
  font-size: 18px;
  font-weight: 600;
}

.popup-content p.description {
  font-size: 16px;
  line-height: 1.5em; /* 24px */
  font-weight: 400;
}

.popup-content p.small {
  font-size: 14px;
  line-height: 1.429em; /* 20px */
  font-weight: 400;
}

/* Popup Actions/Buttons Container */
.popup-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  column-gap: 8px;
  background: var(--color-white-100);
  border-radius: 34px;
  padding: 8px;
}

/* Button Base Styles */
.popup-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  column-gap: 8px;
  border-radius: 41px;
  padding: 12px 16px;
  border: none;
  cursor: pointer;
  font-family: 'Gilroy', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5em; /* 24px */
  letter-spacing: 0;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

/* Secondary Button (Cancel/No) */
.popup-button--secondary {
  background: transparent;
  color: var(--color-black-100);
}

.popup-button--secondary:hover {
  background: rgba(26, 27, 48, 0.05);
}

/* Primary Button (Confirm/Yes) */
.popup-button--primary {
  background: var(--color-accent-100);
  color: var(--color-white-100);
}

.popup-button--primary:hover {
  background: #9a4e05;
}

/* Danger Button (Delete/Remove) */
.popup-button--danger {
  background: #dc2626;
  color: var(--color-white-100);
}

.popup-button--danger:hover {
  background: #b91c1c;
}

/* Form Elements */
.popup-form-group {
  display: flex;
  flex-direction: column;
  row-gap: 4px;
}

.popup-form-label {
  font-size: 14px;
  line-height: 1.429em; /* 20px */
  color: var(--color-black-100);
  font-family: 'Gilroy', sans-serif;
  font-weight: 400;
  margin: 0;
}

.popup-form-field {
  display: flex;
  align-items: center;
  column-gap: 8px;
  border: 1px solid var(--color-off-white-2);
  border-radius: 28px;
  background: var(--color-white-100);
  padding: 16px 16px 16px 24px;
}

.popup-form-input {
  flex-grow: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  line-height: 1.5em; /* 24px */
  color: var(--color-black-100);
  font-family: 'Gilroy', sans-serif;
  font-weight: 400;
}

.popup-form-input::placeholder {
  color: var(--color-black-100);
  opacity: 1;
}

.popup-form-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Warning/Alert Styles */
.popup-warning {
  padding: 16px;
  background: #fef3cd;
  border: 1px solid #fbbf24;
  border-radius: 16px;
  margin: 16px 0;
}

.popup-warning-title {
  font-weight: 600;
  color: #92400e;
  margin: 0 0 4px 0;
}

.popup-warning-text {
  color: #92400e;
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

/* List Styles for Data Display */
.popup-data-list {
  display: flex;
  flex-direction: column;
  row-gap: 12px;
}

.popup-data-item {
  display: flex;
  flex-direction: column;
  row-gap: 4px;
}

.popup-data-label {
  font-size: 14px;
  line-height: 1.429em; /* 20px */
  color: var(--color-black-100);
  font-family: 'Gilroy', sans-serif;
  font-weight: 400;
  margin: 0;
}

.popup-data-value {
  font-size: 16px;
  line-height: 1.5em; /* 24px */
  color: var(--color-black-100);
  font-family: 'Gilroy', sans-serif;
  font-weight: 500;
  margin: 0;
}

/* Background Image Support */
.popup-background {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
  border-radius: calc(var(--popup-border-radius) - 10px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .popup-container {
    width: 95%;
    margin: 0 auto;
    border-radius: 20px;
    max-height: 85vh;
  }
  
  .popup-header {
    padding: 12px 12px 12px 20px;
    border-radius: 20px;
  }
  
  .popup-title {
    font-size: 20px;
    line-height: 1.4em; /* 28px */
  }
  
  .popup-content-wrap {
    padding: 6px;
    border-radius: 20px;
  }
  
  .popup-content {
    padding: 20px;
    border-radius: 16px;
  }
  
  .popup-actions {
    flex-direction: column;
    align-items: stretch;
    row-gap: 8px;
    border-radius: 20px;
  }
  
  .popup-button {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .popup-overlay {
    padding: 10px;
  }
  
  .popup-container {
    width: 100%;
    border-radius: 16px;
  }
  
  .popup-header {
    border-radius: 16px;
  }
  
  .popup-content-wrap {
    border-radius: 16px;
  }
  
  .popup-title {
    font-size: 18px;
    line-height: 1.333em; /* 24px */
  }
}

/* Animation Utilities */
@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes popupFadeOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
}

/* Accessibility Improvements */
.popup-overlay:focus-within {
  outline: none;
}

.popup-button:focus,
.popup-close:focus {
  outline: 2px solid var(--color-accent-100);
  outline-offset: 2px;
}

.popup-form-input:focus {
  outline: none;
}

.popup-form-field:focus-within {
  border-color: var(--color-accent-100);
  box-shadow: 0 0 0 2px rgba(180, 90, 6, 0.1);
}

/* Screen Reader Only Content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}