/* QR Generator Wrapper - Isolated from website theme */
#qr-generator-wrapper {
  /* Reset all inherited styles */
  all: initial;
  
  /* Set our own base styles */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #f1f5f9;
  min-height: 100vh;
  padding: 20px;
  line-height: 1.6;
  box-sizing: border-box;
  display: block;
}

#qr-generator-wrapper * {
  box-sizing: border-box;
  padding: 5px;
}

.blog-grid-view-post {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
}
body.page-template-fullwidth .blog-grid-view-post, body.page-template-default .blog-grid-view-post {
  margin-bottom: 0px;
}
/* QR Generator specific styles */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #10b981;
  --secondary-dark: #059669;
  --accent: #f59e0b;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --error: #ef4444;
  --success: #10b981;
  --shadow: 0 20px 50px rgba(0,0,0,0.5);
  --shadow-lg: 0 30px 70px rgba(0,0,0,0.7);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 40px;
  padding: 30px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.header h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  background: linear-gradient(135deg, #fff, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  letter-spacing: -1px;
}

.header p {
  color: rgba(255,255,255,0.9);
  font-size: clamp(14px, 2vw, 18px);
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.card {
  background: var(--surface);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  border-radius: 2px;
}

/* QR Preview Section */
.qr-preview-card {
  position: sticky;
  top: 20px;
  height: fit-content;
}

.qr-preview {
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  margin-bottom: 20px;
  border: 0px solid var(--border);
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-preview img {
  max-width: 100%;
  max-height: 500px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.qr-preview.loading {
  position: relative;
  overflow: hidden;
}

.qr-preview.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.3), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  to { left: 100%; }
}

.btn-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  min-width: 150px;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(99,102,241,0.5);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  color: white;
}

.btn-secondary:hover {
  box-shadow: 0 8px 25px rgba(16,185,129,0.5);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #f97316);
  color: white;
}

.btn-accent:hover {
  box-shadow: 0 8px 25px rgba(245,158,11,0.5);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Type Selector */
.type-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 25px;
}

.type-btn {
  padding: 14px 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface-light);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.type-btn:hover {
  background: var(--surface);
  border-color: var(--primary);
}

.type-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(99,102,241,0.5);
}

/* Form Elements - UPDATED TEXT COLOR BASED ON SELECTION STATE */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  color: white!important;
  margin-bottom: 8px;
  font-size: 14px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #ffffff; /* White background for black text */
  color: #000000; /* Black text when not selected */
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
}

/* White text when selected/inputting */
.form-input:focus, .form-select:focus, .form-textarea:focus,
.form-input:active, .form-select:active, .form-textarea:active {
  color: #ffffff !important; /* White text when focused/active */
  background: #1e293b; /* Dark background when selected */
}

/* Remove border when input is focused */
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: transparent;
  background: #2d3748; /* Slightly lighter background on focus */
  box-shadow: 0 0 0 2px var(--primary); /* Add shadow instead of border */
}

/* Improve placeholder contrast */
.form-input::placeholder, .form-textarea::placeholder {
  color: #666666; /* Dark gray placeholder for light background */
  opacity: 0.8;
}

/* When input is focused, change placeholder color to lighter */
.form-input:focus::placeholder, .form-textarea:focus::placeholder {
  color: #94a3b8; /* Lighter placeholder when focused */
}

.form-input.valid {
  border-color: var(--success);
}

.form-input.invalid {
  border-color: var(--error);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.char-counter {
  text-align: right;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 5px;
}

.error-message {
  color: var(--error);
  font-size: 13px;
  margin-top: 5px;
  display: none;
}

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

/* Options Section */
.options-section {
  margin-top: 20px;
}

.option-group {
  margin-bottom: 25px;
}

.option-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  font-size: 15px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
  padding: 10px;
  background: var(--background);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.option-grid::-webkit-scrollbar {
  width: 8px;
}

.option-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.option-item {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  position: relative;
}

.option-item:hover {
  border-color: var(--primary);
  box-shadow: 0 5px 20px rgba(99,102,241,0.3);
  z-index: 1;
}

.option-item.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(79,70,229,0.2));
  box-shadow: 0 5px 20px rgba(99,102,241,0.5);
}

.option-item.active::after {
  content: '✓';
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.option-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Color Controls */
.color-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.color-input {
  width: 50% !important;
  height: 45px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.color-input:hover {
/*  border-color: var(--primary);*/
}

.color-value {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface-light);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-light);
  border-radius: 10px;
  cursor: pointer;
}

.checkbox-group:hover {
  background: var(--surface);
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-group label {
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  color: white !important;
}

.gradient-panel, .separate-colors-panel {
  background: var(--background);
  border-radius: 12px;
  padding: 20px;
  margin-top: 15px;
  border: 1px solid var(--border);
  display: none;
}

.gradient-panel.show, .separate-colors-panel.show {
  display: block;
}

.radio-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.radio-option label {
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  color: white !important;
}

/* Additional Text Fields */
.text-controls-grid {
  display: flex;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 15px;
  align-items: end;
  margin-bottom: 15px;
  padding: 15px;
  background: var(--surface-light);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.text-field-group {
  position: relative;
}

.text-field-group .form-group {
  margin-bottom: 0;
}

.color-picker-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker-container .form-control {
  margin-bottom: 0;
}

.text-field-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
  min-width: auto;
  flex: none;
}

.btn-danger {
  background: linear-gradient(135deg, var(--error), #dc2626);
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 8px 25px rgba(239,68,68,0.5);
}

.add-text-btn {
  width: 100%;
  margin-top: 10px;
}

/* Success Message */
.success-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(135deg, var(--success), var(--secondary-dark));
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(16,185,129,0.5);
  display: none;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  z-index: 1000;
}

.success-toast.show {
  display: flex;
}

/* Advanced Frame Popup */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
}

.popup-overlay.active {
  display: flex;
}

.popup-content {
  background: var(--surface);
  border-radius: 20px;
  padding: 30px;
  max-width: 90vw;
  max-height: 90vh;
  width: 1200px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  position: relative;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border);
}

.popup-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-light);
}

.popup-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.popup-close:hover {
  background: var(--surface-light);
  color: var(--primary);
}

.advanced-frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 15px;
  overflow-y: auto;
  padding: 10px;
  max-height: calc(90vh - 150px);
}

.advanced-frame-item {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  position: relative;
}

.advanced-frame-item:hover {
  border-color: var(--primary);
  box-shadow: 0 5px 20px rgba(99,102,241,0.3);
  z-index: 1;
}

.advanced-frame-item.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(79,70,229,0.2));
  box-shadow: 0 5px 20px rgba(99,102,241,0.5);
}

.advanced-frame-item.active::after {
  content: '✓';
  position: absolute;
  top: -5px;
  right: -5px;
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.advanced-frame-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.advanced-frame-name {
  position: absolute;
  bottom: 5px;
  left: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 4px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile Responsive */
@media (max-width: 968px) {
  .main-grid {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }
  
  .qr-preview-card {
    position: static;
    order: 1;
  }
  
  .input-card {
    order: 2;
  }
  
  .options-card {
    order: 3;
  }
  
  .btn-group {
    flex-direction: column;
  }
  
  .btn {
    min-width: 100%;
  }
  
  .text-controls-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .advanced-frames-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
  }
  
  .popup-content {
    padding: 20px;
  }
}

@media (max-width: 640px) {
  #qr-generator-wrapper {
    padding: 10px;
  }
  
  .header {
    padding: 20px 15px;
    margin-bottom: 20px;
  }
  
  .card {
    padding: 20px;
  }
  
  .type-selector {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
  }
  
  .type-btn {
    padding: 10px 8px;
    font-size: 12px;
  }
  
  .option-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    max-height: 150px;
  }
  
  .qr-preview {
    padding: 20px;
    min-height: 300px;
  }
  
  .success-toast {
    bottom: 20px;
    right: 20px;
    left: 20px;
    font-size: 14px;
  }
  
  .advanced-frames-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
  }
  
  .advanced-frame-name {
    font-size: 8px;
  }
}

/* Smooth scrolling */
#qr-generator-wrapper {
  scroll-behavior: smooth;
}