/* Visual Editor Admin Styles */
.mgwpp-editor-container {
  background: #f1f1f1;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mgwpp-editor-header {
  background: white;
  border-bottom: 1px solid #ddd;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mgwpp-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.mgwpp-header-content h2 {
  margin: 0;
  color: #23282d;
}

.mgwpp-header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.mgwpp-gallery-type-select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.mgwpp-editor-main {
  display: flex;
  height: calc(100vh - 80px);
}

.mgwpp-canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  margin: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mgwpp-canvas-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-bottom: 1px solid #ddd;
  background: #f9f9f9;
}

.mgwpp-canvas-container {
  flex: 1;
  overflow: auto;
  position: relative;
}

.mgwpp-canvas {
  position: relative;
  min-height: 100%;
  background: white;
  margin: 1rem;
  border: 2px dashed #ddd;
  border-radius: 8px;
}

.mgwpp-canvas.show-grid {
  background-image: linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
}

.mgwpp-empty-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #666;
}

.mgwpp-canvas-item {
  position: absolute;
  cursor: move;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border-color 0.2s;
}

.mgwpp-canvas-item:hover {
  border-color: #0073aa;
}

.mgwpp-canvas-item.selected {
  border-color: #0073aa;
  box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

.mgwpp-item-content {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 2px;
}

.mgwpp-item-content img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mgwpp-text-content {
  padding: 1rem;
  background: #f9f9f9;
  border: 1px solid #ddd;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mgwpp-button-content {
  background: #0073aa;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.mgwpp-item-controls {
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  pointer-events: none;
}

.mgwpp-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #0073aa;
  border: 2px solid white;
  border-radius: 50%;
  pointer-events: all;
  cursor: pointer;
}

.mgwpp-resize-nw {
  top: -5px;
  left: -5px;
  cursor: nw-resize;
}
.mgwpp-resize-ne {
  top: -5px;
  right: -5px;
  cursor: ne-resize;
}
.mgwpp-resize-sw {
  bottom: -5px;
  left: -5px;
  cursor: sw-resize;
}
.mgwpp-resize-se {
  bottom: -5px;
  right: -5px;
  cursor: se-resize;
}

.mgwpp-rotate-handle {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: #0073aa;
  border: 2px solid white;
  border-radius: 50%;
  cursor: grab;
  pointer-events: all;
}

.mgwpp-delete-handle {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 20px;
  height: 20px;
  background: #dc3232;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: all;
  font-size: 12px;
}

.mgwpp-editor-sidebar {
  width: 320px;
  background: white;
  border-left: 1px solid #ddd;
  display: flex;
  flex-direction: column;
}

.mgwpp-sidebar-panel {
  flex: 1;
  border-bottom: 1px solid #ddd;
}

.mgwpp-panel-header {
  padding: 1rem;
  border-bottom: 1px solid #ddd;
  background: #f9f9f9;
}

.mgwpp-panel-header h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
}

.mgwpp-search-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.mgwpp-media-grid {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  max-height: 300px;
  overflow-y: auto;
}

.mgwpp-media-item {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.mgwpp-media-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.mgwpp-media-thumbnail {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mgwpp-media-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mgwpp-video-thumbnail {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0073aa;
  color: white;
}

.mgwpp-media-info {
  padding: 0.5rem;
}

.mgwpp-media-title {
  font-size: 0.8rem;
  font-weight: 500;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mgwpp-media-type {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
}

.mgwpp-properties-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mgwpp-tab-navigation {
  display: flex;
  border-bottom: 1px solid #ddd;
}

.mgwpp-tab-button {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: #f9f9f9;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.mgwpp-tab-button.active {
  background: white;
  border-bottom-color: #0073aa;
}

.mgwpp-tab-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.mgwpp-control-group {
  margin-bottom: 1rem;
}

.mgwpp-control-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.mgwpp-position-controls,
.mgwpp-size-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.mgwpp-position-controls input,
.mgwpp-size-controls input,
.mgwpp-control-group input[type="text"],
.mgwpp-control-group textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.mgwpp-range-input {
  width: 100%;
  margin: 0.5rem 0;
}

.mgwpp-color-input {
  width: 100%;
  height: 40px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.mgwpp-no-selection {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #666;
}

/* Responsive */
@media (max-width: 1200px) {
  .mgwpp-editor-sidebar {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .mgwpp-editor-main {
    flex-direction: column;
  }

  .mgwpp-editor-sidebar {
    width: 100%;
    height: 40vh;
  }
}


/* Media Selector Styles */
.mgwpp-media-selector {
    margin: 20px 0;
}

.mgwpp-selected-media-container {
    margin-top: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background: #f9f9f9;
}

.mgwpp-selected-media {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mgwpp-media-item {
    position: relative;
    width: 80px;
    height: 80px;
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.mgwpp-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mgwpp-remove-media {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    background: rgba(220, 50, 50, 0.8);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mgwpp-remove-media .dashicons {
    font-size: 16px;
    width: auto;
    height: auto;
}