.drf-buyback-screen {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: #ffffff;
}

.drf-buyback-media {
  flex: 1 1 50%;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  min-height: 300px;
}

.drf-buyback-content {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4vw 6vw;
  max-width: 640px;
}

.drf-buyback-header h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 700;
  margin: 0 0 1rem 0;
}

.drf-buyback-intro {
  color: #5f6368;
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0 0 2.5rem 0;
}

.drf-buyback-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.drf-form-step {
  display: none;
}

.drf-form-step.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.drf-form-step[data-step="4"] {
  display: none;
}

.drf-form-step[data-step="4"].active {
  display: block;
}

.drf-form-step[data-step="5"].active {
  display: block;
}

.drf-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drf-buyback-select-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drf-form-step[data-step="3"] .drf-buyback-select-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.drf-form-step[data-step="3"] .drf-buyback-select-group select {
  width: 100%;
}

.drf-field label {
  font-weight: 600;
  color: #1a1a1a;
}

.drf-field input,
.drf-field select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid #d6d9de;
  background: #ffffff;
  font-size: 1rem;
  transition: border 0.2s ease;
}

.drf-field input:focus,
.drf-field select:focus {
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
  outline: none;
}

/* Ensure consistent select styling (including iOS/Safari) */
.drf-buyback-form select {
  appearance: none;
  -webkit-appearance: none;
  color: #000 !important;
  -webkit-text-fill-color: #000 !important; /* override iOS tint/autofill */
  background-color: #fff;
}

.drf-field input[readonly] {
  background: #f5f7fa;
  color: #4b5563;
  cursor: default;
}

.drf-buyback-conditions-loading {
  padding: 2rem 0;
  color: #6b7280;
  text-align: center;
}

.drf-buyback-conditions .drf-buyback-condition-group {
  margin-bottom: 1.75rem;
}

.drf-buyback-condition-group {
  border: 0;
  padding: 0;
  margin-bottom: 1.75rem;
}

.drf-buyback-condition-group legend {
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding: 0;
}

.drf-buyback-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.drf-buyback-radio-group label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.98rem;
  cursor: pointer;
}

.drf-buyback-radio-group input[type="radio"] {
  accent-color: #2563eb;
}

.drf-offer-box {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: #f3f4f6;
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.125rem;
}

.drf-offer-amount {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
}

.drf-buyback-summary {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
  color: #4b5563;
  font-size: 0.95rem;
}

.drf-buyback-summary ul {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
}

.drf-buyback-footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.drf-button-bar {
  display: flex;
  gap: 1rem;
}

.drf-button-primary,
.drf-button-secondary {
  padding: 0.85rem 2.25rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: none;
}

.drf-button-primary {
  background: #0067c2;
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 102, 194, 0.25);
}

.drf-button-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.drf-button-secondary {
  background: #e5e7eb;
  color: #111827;
}

.drf-button-primary:hover,
.drf-button-secondary:hover {
  transform: translateY(-2px);
}

.drf-step-indicator {
  font-weight: 600;
  color: #1f2937;
}

.drf-status-message {
  min-height: 1.25rem;
  font-size: 0.95rem;
  color: #2563eb;
}

.drf-status-message.is-error {
  color: #b91c1c;
}

@media (max-width: 1024px) {
  .drf-buyback-screen {
    flex-direction: column;
  }

  .drf-buyback-media {
    min-height: 45vh;
  }

  .drf-buyback-content {
    max-width: none;
    width: 100%;
    padding: 3rem 10vw;
  }

  .drf-form-step.active {
    grid-template-columns: 1fr;
  }

  .drf-button-bar {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .drf-buyback-media {
    display: none;
  }

  .drf-buyback-content {
    padding: 2.5rem 1.5rem 3.5rem;
  }

  .drf-buyback-header h1 {
    font-size: 2rem;
  }

  .drf-offer-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

/* ============================================================================
   Progress Bar
   ============================================================================ */

.drf-progress-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 2.5rem 0;
  position: relative;
  padding: 0;
}

.drf-progress-bar::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  height: 1px;
  background: #e0e0e0;
  z-index: 0;
}

.drf-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
  flex: 1;
}

.drf-progress-step .step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 0.9rem;
  color: #757575;
  transition: all 0.2s ease;
}

.drf-progress-step .step-label {
  font-size: 0.75rem;
  color: #757575;
  font-weight: 400;
  text-align: center;
  transition: color 0.2s ease;
}

.drf-progress-step.active .step-number {
  background: #2271b1;
  border-color: #2271b1;
  color: #ffffff;
}

.drf-progress-step.active .step-label {
  color: #2271b1;
  font-weight: 500;
}

.drf-progress-step.completed .step-number {
  background: #00a32a;
  border-color: #00a32a;
  color: #ffffff;
}

.drf-progress-step.completed .step-number::after {
  content: "✓";
  position: absolute;
}

.drf-progress-step.completed .step-label {
  color: #00a32a;
}

/* ============================================================================
   Field Groups & Form Elements
   ============================================================================ */

.drf-field,
.drf-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.drf-field label,
.drf-field-group label {
  font-weight: 500;
  color: #2c3338;
  font-size: 0.9rem;
}

.drf-field label .required,
.drf-field-group label .required {
  color: #d63638;
  margin-left: 2px;
}

.drf-field select,
.drf-field input[type="text"],
.drf-field input[type="email"],
.drf-field input[type="tel"],
.drf-field textarea,
.drf-field-group select,
.drf-field-group input[type="text"],
.drf-field-group input[type="email"],
.drf-field-group input[type="tel"],
.drf-field-group textarea {
  padding: 0.85rem 1rem;
  border: 1px solid #d6d9de;
  border-radius: 16px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #ffffff;
  width: 100%;
}

.drf-field select:focus,
.drf-field input:focus,
.drf-field textarea:focus,
.drf-field-group select:focus,
.drf-field-group input:focus,
.drf-field-group textarea:focus {
  outline: none;
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}

.drf-field select:disabled,
.drf-field-group select:disabled {
  background: #f6f7f7;
  color: #a0a0a0;
  cursor: not-allowed;
}

/* Ensure condition dropdowns match the other buyback selects */
.drf-buyback-condition-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d4dbe8;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  font-family: inherit;
  background: #f7fbff;
  color: #0f172a;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.drf-buyback-condition-select:focus {
  outline: none;
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #000;
}

.drf-buyback-condition-select:disabled {
  background: #f6f7f7;
  color: #a0a0a0;
  cursor: not-allowed;
}

.drf-field .field-help,
.drf-field-group .field-help {
  font-size: 0.85rem;
  color: #646970;
  margin: 0;
  line-height: 1.4;
}

.drf-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.step-description {
  color: #646970;
  font-size: 0.95rem;
  margin: -0.5rem 0 1.5rem 0;
}

.step-description .selected-model {
  font-weight: 600;
  color: #2271b1;
}

/* ============================================================================
   Conditions Section
   ============================================================================ */

.drf-buyback-conditions {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.drf-buyback-conditions-loading {
  text-align: center;
  padding: 2rem;
  color: #646970;
  font-size: 0.95rem;
}

/* ============================================================================
   Price Display
   ============================================================================ */

.drf-price-display {
  background: #2271b1;
  color: #ffffff;
  padding: 1.5rem;
  border-radius: 2px;
  text-align: center;
  margin: 2rem 0;
}

.drf-price-display .price-label {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.drf-price-display .price-amount {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.drf-price-display .price-amount .currency {
  font-size: 1.5rem;
  margin-right: 0.25rem;
}

.drf-price-display .price-note {
  font-size: 0.8rem;
  opacity: 0.8;
  margin: 0;
}

/* ============================================================================
   Loading Overlay
   ============================================================================ */

.drf-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 1rem;
}

.drf-loading-overlay .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e0e0e0;
  border-top-color: #2271b1;
  border-radius: 50%;
  animation: drf-spin 0.8s linear infinite;
}

.drf-loading-overlay p {
  font-size: 1rem;
  color: #646970;
  margin: 0;
}

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

/* ============================================================================
   Buttons
   ============================================================================ */

.drf-button-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.drf-button-secondary {
  padding: 0.7rem 1.5rem;
  background: #ffffff;
  color: #2271b1;
  border: 1px solid #2271b1;
  border-radius: 2px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.drf-button-secondary:hover:not(:disabled) {
  background: #f6f7f7;
}

.drf-button-primary {
  padding: 0.7rem 1.75rem;
  background: #2271b1;
  color: #ffffff;
  border: 1px solid #2271b1;
  border-radius: 2px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  flex: 1;
}

.drf-button-primary:hover:not(:disabled) {
  background: #1a5a8e;
  border-color: #1a5a8e;
}

.drf-button-primary:disabled {
  background: #c0c0c0;
  border-color: #c0c0c0;
  cursor: not-allowed;
  opacity: 0.6;
}

.drf-button-primary .arrow {
  margin-left: 0.5rem;
}

/* ============================================================================
   Step Indicator & Status
   ============================================================================ */

.drf-step-indicator {
  text-align: center;
  padding: 1rem 0 0.5rem;
  font-size: 0.9rem;
  color: #646970;
}

.drf-status-message {
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  display: none;
}

.drf-status-message:not(:empty) {
  display: block;
}

.drf-status-message.is-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.drf-status-message.is-success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* ============================================================================
   Buyback Not Possible - Error Message
   ============================================================================ */

.buyback-not-possible {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  border: 2px solid #ef5350;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  margin: 24px 0;
  animation: fadeIn 0.3s ease-in-out;
}

.buyback-not-possible .error-icon {
  font-size: 56px;
  display: block;
  margin-bottom: 16px;
  animation: pulse 2s infinite;
}

.buyback-not-possible h3 {
  font-size: 26px;
  font-weight: 700;
  color: #c62828;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.buyback-not-possible p {
  font-size: 16px;
  color: #b71c1c;
  margin: 0;
  line-height: 1.5;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes borderPulse {
  0%,
  100% {
    border-color: #ef5350;
    box-shadow: 0 0 20px rgba(239, 83, 80, 0.3);
  }
  50% {
    border-color: #c62828;
    box-shadow: 0 0 30px rgba(239, 83, 80, 0.5);
  }
}

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

@keyframes shake {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-10deg);
  }
  75% {
    transform: rotate(10deg);
  }
}

@keyframes buttonShake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

/* ============================================================================
   Enhanced Broken Device Feedback
   ============================================================================ */

/* Warning banner above error box */
.buyback-broken-warning {
  background: linear-gradient(135deg, #ff5252 0%, #ef5350 100%);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 16px;
  animation: slideDown 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(239, 83, 80, 0.4);
}

.buyback-broken-warning-icon {
  font-size: 28px;
  animation: shake 0.5s ease-in-out infinite;
  display: inline-block;
}

/* Enhanced error box with stronger visuals */
.buyback-not-possible {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  border: 3px solid #ef5350;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  margin: 24px 0;
  animation: fadeIn 0.3s ease-in-out, borderPulse 2s ease-in-out infinite;
  box-shadow: 0 6px 24px rgba(239, 83, 80, 0.35);
}

.buyback-not-possible .error-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================================================
   Submit Button - Disabled State for Broken Condition
   ============================================================================ */

.drf-button-primary:disabled,
button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #9e9e9e !important;
  border-color: #9e9e9e !important;
  pointer-events: all !important;
  position: relative;
}

.drf-button-primary:disabled:hover {
  background: #9e9e9e !important;
  transform: none;
  box-shadow: none;
}

/* Tooltip on disabled button */
.drf-button-primary.disabled-broken::after {
  content: "⚠️ Ne možete nastaviti sa pokvarenim uređajem";
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%);
  background: #ef5350;
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  font-weight: 600;
}

.drf-button-primary.disabled-broken:hover::after {
  opacity: 1;
}

/* Shake animation when clicking disabled button */
.drf-button-primary.shake {
  animation: buttonShake 0.5s;
}

/* ============================================================================
   Responsive - Mobile
   ============================================================================ */

@media (max-width: 768px) {
  .drf-progress-bar {
    margin-bottom: 2rem;
  }

  .drf-progress-step .step-label {
    font-size: 0.7rem;
  }

  .drf-progress-step .step-number {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .drf-field-row {
    grid-template-columns: 1fr;
  }

  .drf-button-bar {
    flex-direction: column-reverse;
  }

  .drf-button-secondary,
  .drf-button-primary {
    width: 100%;
  }

  .drf-price-display .price-amount {
    font-size: 2rem;
  }

  /* Error Message on Mobile */
  .buyback-not-possible {
    padding: 24px 20px;
    margin: 20px 0;
  }

  .buyback-not-possible .error-icon {
    font-size: 48px;
  }

  .buyback-not-possible h3 {
    font-size: 20px;
  }

  .buyback-not-possible p {
    font-size: 14px;
  }

  /* Warning banner on mobile */
  .buyback-broken-warning {
    font-size: 14px;
    padding: 12px 16px;
    flex-wrap: wrap;
  }

.buyback-broken-warning-icon {
  font-size: 24px;
}

/* Disabled button tooltip on mobile */
  .drf-button-primary.disabled-broken::after {
    font-size: 11px;
    padding: 8px 14px;
    bottom: -40px;
    white-space: normal;
    max-width: 250px;
    text-align: center;
  }

  .buyback-not-possible .error-icon {
    font-size: 48px;
  }

  .buyback-not-possible h3 {
    font-size: 22px;
  }

  .buyback-not-possible p {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .drf-progress-step .step-label {
    display: none;
  }

  .drf-progress-step .step-number {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  /* Error Message on Small Mobile */
  .buyback-not-possible {
    padding: 20px 16px;
  }

  .buyback-not-possible .error-icon {
    font-size: 40px;
  }

  .buyback-not-possible h3 {
    font-size: 20px;
  }

  .buyback-not-possible p {
    font-size: 14px;
  }
}

/* ============================================================================
   Condition Form - Refreshed Styling
   ============================================================================ */

/* Container spacing */
.drf-buyback-form .drf-buyback-conditions {
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Fieldset reset and card-like look */
.drf-buyback-form .drf-buyback-condition-group {
  border: 0;
  padding: 0;
  margin: 0 0 1rem 0;
}

.drf-buyback-form .drf-buyback-condition-group legend,
.drf-buyback-form .drf-condition-field label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.4rem;
  padding: 0;
}

/* Wrapper around each select */
.drf-buyback-form .drf-buyback-select-group,
.drf-buyback-form .drf-condition-field {
  background: #f7fbff;
  border: 1px solid #d4dbe8;
  border-radius: 18px;
  padding: 14px 14px 10px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Consistent select styling for dynamic and static condition selects */
.drf-buyback-form .drf-buyback-select-group select,
.drf-buyback-form .drf-buyback-condition-select,
.drf-buyback-form select[name^="condition["] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d4dbe8;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.4;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.drf-buyback-form .drf-buyback-select-group select:focus,
.drf-buyback-form .drf-buyback-condition-select:focus,
.drf-buyback-form select[name^="condition["]:focus {
  outline: none;
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #000;
}

.drf-buyback-form .drf-buyback-select-group select:disabled,
.drf-buyback-form .drf-buyback-condition-select:disabled,
.drf-buyback-form select[name^="condition["]:disabled {
  background: #f1f3f7;
  color: #a0a7b4;
  cursor: not-allowed;
}

.drf-buyback-form .drf-help-text {
  margin: 0;
  font-size: 0.85rem;
  color: #5f6368;
}
