/**
 * Frontend Styles: Preisvorschlag Modal & Negotiation Landing Page
 * Afterdeals Design System
 */

:root {
  --pv-primary: #ffa41c;
  --pv-primary-hover: #f39810;
  --pv-primary-light: #fff7ed;
  --pv-primary-border: #fed7aa;
  --pv-paypal: #ffd814;
  --pv-paypal-hover: #f7ca00;
  --pv-dark: #1e293b;
  --pv-gray-light: #f8fafc;
  --pv-gray-border: #e2e8f0;
  --pv-text-muted: #64748b;
  --pv-radius: 8px;
  --pv-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Single Product Button
   ========================================================================== */
.pv-single-product-btn-wrap {
  margin: 4px 0 0 0;
  width: 100%;
  display: block;
}

.pv-trigger-modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  padding: 0 20px;
  background-color: var(--pv-primary);
  color: #0F1111;
  border: 1px solid #ff8f00;
  border-radius: 50px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(255, 164, 28, 0.2);
  box-sizing: border-box;
}

.pv-trigger-modal-btn svg {
  color: #0F1111;
  stroke: #0F1111;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.pv-trigger-modal-btn:hover {
  background-color: var(--pv-primary-hover);
  color: #0F1111;
  border-color: #e07e00;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 164, 28, 0.35);
}

.pv-trigger-modal-btn:hover svg {
  transform: scale(1.1) rotate(-5deg);
}

/* Modal Scroll Lock & Containment */
html.pv-modal-open,
body.pv-modal-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

/* ==========================================================================
   Modal Dialog & Overlay
   ========================================================================== */
.pv-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: -webkit-fill-available;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 24px 16px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  overflow-y: auto;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch;
}

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

.pv-modal-container {
  background: #ffffff;
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  border-radius: 12px;
  box-shadow: var(--pv-shadow);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  animation: pvSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  margin: auto;
  flex-shrink: 0;
}

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

.pv-modal-header {
  padding: 20px 24px;
  background: var(--pv-primary);
  color: #0F1111;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.pv-modal-header-icon {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0F1111;
}

.pv-modal-header-text {
  flex: 1;
}

.pv-modal-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #0F1111;
}

.pv-modal-subtitle {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: rgba(15, 17, 17, 0.85);
}

.pv-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #0F1111;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.pv-modal-close:hover {
  opacity: 1;
}

/* Product Summary in Modal */
.pv-product-summary {
  padding: 16px 24px;
  background: #f8fafc;
  border-bottom: 1px solid var(--pv-gray-border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.pv-product-img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--pv-gray-border);
  flex-shrink: 0;
  background: #ffffff;
}

.pv-product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pv-product-info {
  flex: 1;
  min-width: 0;
}

.pv-product-title {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--pv-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-product-pricing {
  font-size: 13px;
  color: var(--pv-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pv-regular-price-display {
  font-weight: 700;
  color: #286230;
}

.pv-shipping-hint {
  color: #64748b;
  font-size: 12px;
}

.pv-active-variation-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e2e8f0;
  font-size: 12px;
  color: #334155;
  font-weight: 500;
}

/* Form Styles */
.pv-offer-form {
  padding: 20px 24px;
}

.pv-grid-row {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.pv-col-6 {
  flex: 1;
  min-width: 0;
}

.pv-form-group {
  margin-bottom: 14px;
}

.pv-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.pv-required {
  color: #ef4444;
}

.pv-form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--pv-gray-border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--pv-dark);
  background-color: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.pv-form-control:focus {
  border-color: var(--pv-primary);
  box-shadow: 0 0 0 3px rgba(255, 164, 28, 0.25);
}

.pv-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pv-input-euro input {
  padding-right: 32px;
}

.pv-euro-symbol {
  position: absolute;
  right: 12px;
  color: #94a3b8;
  font-weight: 600;
  pointer-events: none;
}

.pv-textarea {
  resize: vertical;
  min-height: 55px;
}

/* Live Total Calc */
.pv-total-calculation {
  background: var(--pv-primary-light);
  border: 1px solid var(--pv-primary-border);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 14px 0;
}

.pv-calc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #9a3412;
}

.pv-calc-item strong {
  font-size: 16px;
}

.pv-calc-savings {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #fdba74;
  font-size: 13px;
  color: #c2410c;
}

/* Consent Checkbox */
.pv-consent-group {
  margin-top: 12px;
}

.pv-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  line-height: 1.4;
}

.pv-checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  cursor: pointer;
}

/* Feedback & Alerts */
.pv-form-feedback {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.4;
}

.pv-feedback-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.pv-feedback-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Modal Footer & Buttons */
.pv-modal-footer {
  margin-top: 16px;
}

#pv-modal-overlay button#pv-submit-btn,
#pv-modal-overlay .pv-btn-submit,
button.pv-btn-submit,
.pv-offer-form button[type="submit"].pv-btn-submit,
.pv-modal-container button.pv-btn-submit {
  width: 100% !important;
  padding: 14px 20px !important;
  background: #ffd814 !important;
  background-color: #ffd814 !important;
  color: #111827 !important;
  border: 1px solid #fcd34d !important;
  border-radius: 6px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  box-shadow: 0 2px 4px rgba(255, 216, 20, 0.2) !important;
  text-decoration: none !important;
  outline: none !important;
}

#pv-modal-overlay button#pv-submit-btn:hover,
#pv-modal-overlay .pv-btn-submit:hover,
button.pv-btn-submit:hover,
.pv-offer-form button[type="submit"].pv-btn-submit:hover,
.pv-modal-container button.pv-btn-submit:hover {
  background: #f7ca00 !important;
  background-color: #f7ca00 !important;
  border-color: #f2c200 !important;
  color: #111827 !important;
}

#pv-modal-overlay button#pv-submit-btn .pv-btn-text,
#pv-modal-overlay .pv-btn-submit .pv-btn-text,
.pv-btn-submit span.pv-btn-text {
  color: #111827 !important;
  font-weight: 700 !important;
}

.pv-btn-submit:disabled {
  opacity: 0.7 !important;
  cursor: not-allowed !important;
}

.pv-guarantee-note {
  margin: 10px 0 0 0;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

/* Spinner */
.pv-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(17, 24, 39, 0.2) !important;
  border-top-color: #111827 !important;
  border-radius: 50%;
  animation: pvSpin 0.8s linear infinite;
  display: inline-block;
}

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

/* Success Screen */
.pv-success-screen {
  padding: 40px 24px;
  text-align: center;
}

.pv-success-icon {
  margin-bottom: 16px;
}

.pv-success-screen h3 {
  font-size: 20px;
  color: #0f172a;
  margin: 0 0 10px 0;
}

.pv-success-screen p {
  color: #64748b;
  font-size: 14px;
  line-height: 1.6;
  max-width: 440px;
  margin: 0 auto 24px auto;
}

.pv-btn-success-close {
  max-width: 260px;
  margin: 0 auto;
}

/* ==========================================================================
   Negotiation Landing Page Styles
   ========================================================================== */
.pv-negotiation-wrapper {
  max-width: 960px;
  margin: 30px auto 60px auto;
  padding: 0 16px;
  font-family: inherit;
}

.pv-banner {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.pv-banner h3 {
  margin: 0 0 6px 0;
  font-size: 17px;
}

.pv-banner p {
  margin: 0;
  font-size: 14px;
}

.pv-banner-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.pv-banner-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.pv-banner-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.pv-negotiation-card {
  background: #ffffff;
  border: 1px solid var(--pv-gray-border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.pv-negotiation-card h3 {
  margin: 0 0 16px 0;
  font-size: 17px;
  color: var(--pv-dark);
  border-bottom: 1px solid var(--pv-gray-border);
  padding-bottom: 10px;
}

.pv-header-card {
  background: linear-gradient(135deg, var(--pv-primary-light) 0%, #ffffff 100%);
  border-color: var(--pv-primary-border);
}

.pv-header-badge {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.pv-badge-tag {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
}

.pv-badge-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}

.pv-status-counter_sent { background: #dcfce7; color: #15803d; }
.pv-status-accepted_pending_payment { background: #dcfce7; color: #15803d; }
.pv-status-pending_admin_review { background: #fef3c7; color: #b45309; }
.pv-status-expired { background: #fee2e2; color: #991b1b; }

.pv-lead {
  font-size: 15px;
  color: #475569;
  margin: 8px 0 16px 0;
}

.pv-countdown-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fef2f2;
  color: #b91c1c;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.pv-negotiation-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

@media only screen and (max-width: 820px) {
  .pv-negotiation-grid {
    grid-template-columns: 1fr;
  }
}

/* Product details in negotiation page */
.pv-product-row {
  display: flex;
  gap: 20px;
}

.pv-product-thumb {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--pv-gray-border);
  flex-shrink: 0;
}

.pv-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pv-product-details {
  flex: 1;
}

.pv-product-details h4 {
  margin: 0 0 6px 0;
  font-size: 17px;
  color: var(--pv-dark);
}

.pv-variation-meta {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 12px 0;
}

.pv-price-comparison-table {
  background: #f8fafc;
  border: 1px solid var(--pv-gray-border);
  border-radius: 6px;
  padding: 12px 16px;
}

.pv-price-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
}

.pv-highlight-row {
  border-top: 1px solid var(--pv-gray-border);
  padding-top: 8px;
  margin-top: 4px;
}

.pv-green-text { color: #286230; font-weight: bold; }
.pv-red-text { color: #dc2626; font-weight: bold; }

.pv-total-row {
  font-size: 16px;
  font-weight: 700;
  border-top: 2px solid var(--pv-gray-border);
  padding-top: 8px;
  margin-top: 6px;
}

.pv-savings-row {
  color: #15803d;
  font-weight: 600;
  background: #f0fdf4;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 4px;
}

.pv-ustg-small {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 8px;
}

/* Timeline */
.pv-timeline {
  position: relative;
  padding-left: 24px;
}

.pv-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #e2e8f0;
}

.pv-timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.pv-timeline-marker {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cbd5e1;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px #e2e8f0;
}

.pv-timeline-admin .pv-timeline-marker {
  background: var(--pv-primary);
}

.pv-timeline-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #334155;
  margin-bottom: 4px;
}

.pv-timeline-date {
  color: #94a3b8;
  font-size: 12px;
}

.pv-timeline-body {
  font-size: 14px;
  color: #475569;
}

.pv-timeline-body p {
  margin: 0 0 6px 0;
}

.pv-counter-highlight {
  color: #0369a1;
  font-weight: 500;
}

.pv-timeline-note {
  margin: 6px 0 0 0;
  padding: 8px 12px;
  background: #f8fafc;
  border-left: 3px solid #cbd5e1;
  font-size: 13px;
  color: #475569;
  border-radius: 0 4px 4px 0;
}

/* Actions in Sidebar */
.pv-action-card {
  position: relative;
}

.pv-card-primary {
  border-color: var(--pv-primary-border);
  background: var(--pv-primary-light);
}

.pv-action-tag {
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--pv-primary);
  color: #0F1111;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  text-transform: uppercase;
}

.pv-tag-gray {
  background: #64748b;
  color: #ffffff;
}

.pv-action-card h4 {
  margin: 8px 0 8px 0;
  font-size: 16px;
  color: var(--pv-dark);
}

.pv-action-card p {
  font-size: 13px;
  color: #475569;
  margin: 0 0 16px 0;
}

.pv-btn-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  text-decoration: none;
  font-size: 14px;
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.pv-btn-primary {
  background: var(--pv-primary);
  color: #0F1111 !important;
  border: 1px solid #ff8f00;
}

.pv-btn-primary:hover {
  background: var(--pv-primary-hover);
  border-color: #e07e00;
  color: #0F1111 !important;
}

.pv-btn-secondary {
  background: #f1f5f9;
  color: #334155 !important;
  border: 1px solid #cbd5e1;
}

.pv-btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a !important;
}

.pv-btn-paypal {
  background: var(--pv-paypal);
  color: #111827 !important;
  border: 1px solid #fcd34d;
}

.pv-btn-paypal:hover {
  background: var(--pv-paypal-hover);
}

.pv-secure-text {
  display: block;
  text-align: center;
  font-size: 11px;
  color: #15803d;
  margin-top: 8px;
}

/* ==========================================================================
   Mobile Responsive Optimizations
   ========================================================================== */
@media only screen and (max-width: 640px) {
  .pv-modal-overlay {
    display: block !important;
    overflow-x: hidden !important;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 12px 10px !important;
    padding-top: max(12px, env(safe-area-inset-top)) !important;
    padding-bottom: max(100px, calc(env(safe-area-inset-bottom) + 80px)) !important;
  }

  .pv-modal-container {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    margin: 8px auto 40px auto !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
  }

  .pv-modal-header {
    padding: 14px 16px;
    gap: 10px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

  .pv-modal-title {
    font-size: 16px;
  }

  .pv-modal-subtitle {
    font-size: 12px;
  }

  .pv-product-summary {
    padding: 12px 16px;
    gap: 12px;
  }

  .pv-product-img {
    width: 48px;
    height: 48px;
  }

  .pv-product-title {
    font-size: 14px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .pv-offer-form {
    padding: 16px 14px 24px 14px;
  }

  /* Prevent mobile zoom on focus */
  .pv-form-control,
  .pv-offer-form input,
  .pv-offer-form select,
  .pv-offer-form textarea {
    font-size: 16px !important;
  }

  .pv-grid-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
  }

  .pv-col-6 {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    width: auto !important;
  }

  .pv-form-group {
    margin-bottom: 12px;
  }

  .pv-total-calculation {
    margin: 12px 0;
    padding: 12px 14px;
  }

  .pv-modal-footer {
    margin-top: 16px;
    padding-bottom: 16px;
  }

  #pv-modal-overlay button#pv-submit-btn,
  #pv-modal-overlay .pv-btn-submit,
  button.pv-btn-submit {
    padding: 14px 16px !important;
    font-size: 14.5px !important;
    min-height: 48px !important;
  }

  .pv-guarantee-note {
    margin-top: 10px;
    font-size: 11.5px;
    line-height: 1.4;
  }
}
