/**
 * Widget Management Styles
 * 
 * Styles for the widget configuration page and modals.
 */

/* Widget Card Styles */
.widget-card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.widget-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* Widget Modal Styles */
.widget-modal-content {
  animation: slideDown 0.3s ease-out;
}

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

/* Form Section Styles */
.widget-form-section .form-section {
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 20px;
}

.widget-form-section .form-section h4 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.widget-form-section .form-group {
  margin-bottom: 15px;
}

.widget-form-section .form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.widget-form-section .form-group input[type="text"],
.widget-form-section .form-group input[type="tel"],
.widget-form-section .form-group input[type="number"],
.widget-form-section .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.widget-form-section .form-group input:focus,
.widget-form-section .form-group textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.widget-form-section .form-group small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #666;
}

/* Preview Section Styles */
.widget-preview-section {
  height: fit-content;
}

.widget-preview-section h4 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

#widgetButtonPreview:hover {
  transform: scale(1.05);
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #ddd;
}

/* Modal Responsive */
@media (max-width: 768px) {
  .widget-modal-content .modal-body {
    grid-template-columns: 1fr !important;
  }

  .widget-preview-section {
    position: relative !important;
    top: 0 !important;
  }
}

/* Button Styles */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-primary {
  background: #007bff;
  color: white;
}

.btn-primary:hover {
  background: #0056b3;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

/* Embed Code Modal */
#embedCodeModal pre {
  white-space: pre-wrap;
  word-wrap: break-word;
}

#embedCodeModal button {
  transition: background 0.2s;
}

#embedCodeModal button:hover {
  background: #0056b3 !important;
}

/* Loading State */
.widget-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  color: #999;
}

.widget-loading::after {
  content: '';
  width: 20px;
  height: 20px;
  margin-left: 10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Empty State */
.widget-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.widget-empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.5;
}

/* Color Picker Enhancement */
input[type="color"] {
  cursor: pointer;
  transition: transform 0.2s;
}

input[type="color"]:hover {
  transform: scale(1.05);
}

/* Checkbox Enhancement */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin-right: 8px;
}

/* Responsive Grid */
@media (max-width: 1200px) {
  #widgetsContainer > div {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  #widgetsContainer > div {
    grid-template-columns: 1fr !important;
  }
}

/* Animation for widget cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.widget-card {
  animation: fadeInUp 0.3s ease-out;
  animation-fill-mode: both;
}

.widget-card:nth-child(1) { animation-delay: 0.05s; }
.widget-card:nth-child(2) { animation-delay: 0.1s; }
.widget-card:nth-child(3) { animation-delay: 0.15s; }
.widget-card:nth-child(4) { animation-delay: 0.2s; }
.widget-card:nth-child(5) { animation-delay: 0.25s; }
.widget-card:nth-child(6) { animation-delay: 0.3s; }

/* RTL Support */
[dir="rtl"] .widget-form-section .form-group label {
  text-align: right;
}

[dir="rtl"] .widget-form-section .form-group small {
  text-align: right;
}

[dir="rtl"] .form-actions {
  justify-content: flex-start;
}

[dir="rtl"] #widgetButtonPreview {
  left: 20px;
  right: auto;
}

[dir="rtl"] input[type="checkbox"] {
  margin-right: 0;
  margin-left: 8px;
}
