/* ===== ADMIN STYLES - Clean Dialog-Based Interface with WordPress Default Buttons ===== */

/* Main container - Clean and simple */
.smm-admin-container {
  margin: 15px 0;
  max-width: 100%;
  overflow: hidden;
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.smm-admin-container .description {
  font-style: normal;
  word-wrap: break-word;
  color: #646970;
  font-size: 13px;
  line-height: 1.5;
}

/* Enable toggle section */
.field-mega-menu {
  background: #f6f7f7;
  border-bottom: 1px solid #dcdcde;
  padding: 15px 20px !important;
  margin: 0 !important;
}

.field-mega-menu label {
  font-weight: 600;
  color: #1d2327;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-mega-menu input[type="checkbox"] {
  margin: 0 !important;
}

.field-mega-menu .description {
  margin-top: 5px;
  font-size: 13px;
  color: #646970;
}

/* Builder Interface - Summary Card Style */
.smm-builder-interface {
  padding: 20px;
}

.smm-builder-summary {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 6px;
  overflow: hidden;
}

.smm-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  gap: 20px;
}

.smm-summary-content {
  flex: 1;
  min-width: 0;
}

.smm-summary-content h4 {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1d2327;
  word-wrap: break-word;
}

.smm-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.smm-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #50575e;
  background: #f6f7f7;
  padding: 6px 12px;
  border-radius: 4px;
  white-space: nowrap;
}

.smm-stat .dashicons {
  color: #0073aa;
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 1;
  vertical-align: middle;
}

.smm-summary-description {
  margin: 0;
  font-size: 13px;
  color: #646970;
  line-height: 1.5;
  word-wrap: break-word;
}

.smm-summary-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* WordPress Default Button Styling - Remove Custom Overrides */
.smm-summary-actions .button {
  /* Let WordPress handle all button styling */
  min-width: 140px;
  justify-content: center;
  text-align: center;
}

.smm-summary-actions .button .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 1;
  vertical-align: middle;
  margin-right: 4px;
}

/* Save notice styling */
.smm-save-notice {
  margin: 15px 20px 0 20px !important;
}

/* ===== DIALOG STYLES - Professional & User-Friendly ===== */

/* Dialog container */
#smm-builder-dialog {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Override jQuery UI Dialog styles */
.ui-dialog {
  z-index: 160000 !important; /* Higher than WordPress admin */
  max-width: 95vw !important;
}

.ui-dialog .ui-dialog-titlebar {
  background: #0073aa !important;
  color: #fff !important;
  border: none !important;
  padding: 12px 16px !important;
  font-weight: 600 !important;
}

.ui-dialog .ui-dialog-titlebar .ui-dialog-title {
  color: #fff !important;
  font-size: 16px !important;
  font-weight: 600 !important;
}

.ui-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close {
  background: none !important;
  border: none !important;
  color: #fff !important;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 24px !important;
  height: 24px !important;
  border-radius: 3px !important;
}

.ui-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

.ui-dialog .ui-dialog-content {
  padding: 0 !important;
  overflow: auto !important;
  max-height: none !important;
}

.ui-dialog .ui-dialog-buttonpane {
  background: #f6f7f7 !important;
  border-top: 1px solid #dcdcde !important;
  padding: 12px 16px !important;
  text-align: right !important;
}

.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
  float: none !important;
  display: inline-flex !important;
  gap: 8px !important;
}

/* Let WordPress handle dialog button styling */
.ui-dialog .ui-dialog-buttonpane .ui-button {
  /* Remove all custom styling - let WordPress .button class handle it */
  margin: 0 !important;
  font-family: inherit !important;
}

.smm-dialog-content {
  padding: 0;
  background: #f6f7f7;
  min-height: 400px;
  overflow: visible;
}

/* Dialog header */
.smm-dialog-header {
  background: #fff;
  padding: 20px 24px;
  border-bottom: 1px solid #dcdcde;
  margin-bottom: 0;
}

.smm-dialog-header h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1d2327;
}

.smm-dialog-header .description {
  margin: 0;
  color: #646970;
  font-size: 14px;
  line-height: 1.5;
}

/* Columns section */
.smm-dialog-columns {
  padding: 20px 24px;
  overflow-x: auto;
  overflow-y: visible;
}

.smm-columns-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.smm-columns-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1d2327;
}

/* WordPress Default Button - Remove Custom Styling */
.smm-add-column .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 1;
  vertical-align: middle;
  margin-right: 4px;
}

/* Columns list - Allow unlimited columns with better full-width support */
.smm-columns-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  min-height: 200px;
}

/* No columns message */
.smm-no-columns-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border: 2px dashed #c3c4c7;
  border-radius: 8px;
  color: #646970;
}

.smm-no-columns-msg p {
  margin: 0;
  font-size: 16px;
  color: #646970;
}

/* Column styling */
.smm-column {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 6px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  min-height: 200px;
}

.smm-column-header {
  background: #f6f7f7;
  border-bottom: 1px solid #dcdcde;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Column settings section */
.smm-column-settings {
  background: #f9f9f9;
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 16px;
}

.smm-column-settings .smm-form-group {
  margin-bottom: 0;
}

.smm-column-settings .smm-field-label {
  font-size: 11px;
  margin-bottom: 4px;
  color: #646970;
}

.smm-column-settings input {
  font-size: 12px;
  padding: 6px 8px;
  height: auto;
  min-height: 28px;
}

.smm-column-settings .description {
  margin-top: 4px;
  font-size: 11px;
  color: #646970;
  line-height: 1.3;
}

.smm-column-drag-handle {
  cursor: move;
  color: #8c8f94;
  font-size: 16px;
  padding: 4px;
  border-radius: 3px;
  transition: color 0.2s ease;
  line-height: 1;
  vertical-align: middle;
}

.smm-column-drag-handle:hover {
  color: #0073aa;
  background: rgba(0, 115, 170, 0.1);
}

.smm-column-header h5 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1d2327;
  flex: 1;
  min-width: 0;
}

.smm-column-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* WordPress Default Button - Remove Custom Styling */
.smm-add-block .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  line-height: 1;
  vertical-align: middle;
  margin-right: 2px;
}

/* WordPress Default Button Link Delete */
.smm-remove-column .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 1;
  vertical-align: middle;
  margin: 0;
}

/* Column blocks */
.smm-column-blocks {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 120px;
}

.smm-no-blocks-msg {
  text-align: center;
  padding: 40px 20px;
  color: #646970;
  border: 2px dashed #dcdcde;
  border-radius: 6px;
  background: #f9f9f9;
}

.smm-no-blocks-msg p {
  margin: 0;
  font-size: 14px;
}

/* Block styling */
.smm-block {
  background: #f9f9f9;
  border: 1px solid #dcdcde;
  border-radius: 4px;
  overflow: hidden;
}

.smm-block-header {
  background: #fff;
  border-bottom: 1px solid #dcdcde;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.smm-block-drag-handle {
  cursor: move;
  color: #8c8f94;
  font-size: 14px;
  padding: 2px;
  border-radius: 2px;
  transition: color 0.2s ease;
  line-height: 1;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.smm-block-drag-handle:hover {
  color: #0073aa;
  background: rgba(0, 115, 170, 0.1);
}

.smm-block-type-selector {
  flex: 1;
  min-width: 0;
  height: 28px;
  font-size: 12px;
  border: 1px solid #8c8f94;
  border-radius: 3px;
  padding: 2px 6px;
}

.smm-block-type-selector:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
  outline: none;
}

/* WordPress Default Button Link Delete */
.smm-remove-block .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  line-height: 1;
  vertical-align: middle;
  margin: 0;
}

/* Block content */
.smm-block-content {
  padding: 16px 12px;
  background: #fff;
}

/* Form groups in dialog */
.smm-form-group {
  margin-bottom: 16px;
}

.smm-form-group:last-child {
  margin-bottom: 0;
}

.smm-form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #1d2327;
  font-size: 13px;
}

.smm-form-group input,
.smm-form-group textarea,
.smm-form-group select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #8c8f94;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.4;
}

.smm-form-group input:focus,
.smm-form-group textarea:focus,
.smm-form-group select:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
  outline: none;
}

.smm-form-group .description {
  margin-top: 4px;
  font-size: 12px;
  color: #646970;
  line-height: 1.4;
}

/* Menu items section in dialog - Improved UI */
.smm-menu-items-section {
  margin-top: 16px;
}

.smm-menu-items-section label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #1d2327;
  font-size: 13px;
}

.smm-menu-items-section .description {
  margin-bottom: 12px;
  font-size: 12px;
  color: #646970;
  line-height: 1.4;
}

.smm-menu-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

/* Menu Item Card - New improved layout */
.smm-menu-item-card {
  background: #fff;
  border: 1px solid #dcdcde;
  border-radius: 6px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.smm-menu-item-card:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.smm-menu-item-header {
  background: #f6f7f7;
  border-bottom: 1px solid #dcdcde;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  position: relative;
}

.smm-menu-item-header:hover {
  background: #f0f0f1;
}

.smm-menu-item-header::before {
  content: "⋮⋮";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #8c8f94;
  font-size: 14px;
  letter-spacing: -2px;
  pointer-events: none;
  opacity: 0.6;
}

.smm-item-number {
  background: #0073aa;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.smm-menu-item-fields {
  padding: 16px;
}

.smm-field-group {
  margin-bottom: 12px;
}

.smm-field-group:last-child {
  margin-bottom: 0;
}

.smm-field-label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  color: #1d2327;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.smm-field-group input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #8c8f94;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.smm-field-group input:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
  outline: none;
}

.smm-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.smm-field-row:last-child {
  margin-bottom: 0;
}

.smm-field-small input {
  font-size: 12px;
  padding: 6px 8px;
}

/* Menu item placeholder for sortable */
.smm-menu-item-placeholder {
  background: #e8f5e8;
  border: 2px dashed #46b450;
  border-radius: 6px;
  height: 120px;
  opacity: 0.5;
  margin-bottom: 12px;
}

/* WordPress Default Button Link Delete */
.smm-remove-menu-item .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  line-height: 1;
  vertical-align: middle;
  margin: 0;
}

/* WordPress Default Button */
.smm-add-menu-item .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  line-height: 1;
  vertical-align: middle;
  margin-right: 2px;
}

/* Image upload in dialog */
.smm-image-upload-area {
  border: 1px solid #dcdcde;
  border-radius: 4px;
  overflow: hidden;
  background: #f9f9f9;
}

.smm-image-preview {
  position: relative;
  text-align: center;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.smm-image-preview img {
  max-width: 100%;
  max-height: 120px;
  height: auto;
  border-radius: 4px;
}

.smm-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.smm-image-preview:hover .smm-image-overlay {
  opacity: 1;
}

.smm-image-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: #646970;
}

.smm-image-placeholder .dashicons {
  font-size: 48px;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: #c3c4c7;
  line-height: 1;
  vertical-align: middle;
}

.smm-image-placeholder p {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #646970;
}

/* Sortable placeholders */
.smm-column-placeholder {
  background: #e1f5fe;
  border: 2px dashed #0073aa;
  border-radius: 6px;
  height: 200px;
  opacity: 0.5;
}

.smm-block-placeholder {
  background: #e8f5e8;
  border: 2px dashed #46b450;
  border-radius: 4px;
  height: 60px;
  opacity: 0.5;
}

/* Responsive dialog styles */
@media (max-width: 1600px) {
  .smm-columns-list {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 1200px) {
  .smm-columns-list {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 1024px) {
  .smm-columns-list {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  }
  
  .smm-summary-card {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  
  .smm-stats {
    justify-content: center;
  }
  
  .smm-summary-actions {
    flex-direction: row;
    justify-content: center;
  }
}

@media (max-width: 782px) {
  .ui-dialog {
    width: 98% !important;
    max-width: none !important;
    height: 90vh !important;
  }
  
  .smm-dialog-content {
    padding: 0;
  }
  
  .smm-dialog-header {
    padding: 16px 20px;
  }
  
  .smm-dialog-columns {
    padding: 16px 20px;
  }
  
  .smm-columns-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .smm-columns-header h4 {
    text-align: center;
  }
  
  .smm-columns-list {
    grid-template-columns: 1fr;
  }
  
  .smm-column-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .smm-column-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  
  /* Mobile responsive for menu item cards */
  .smm-field-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .smm-menu-item-fields {
    padding: 12px;
  }
  
  .smm-menu-item-header {
    padding: 6px 10px;
  }
  
  .smm-item-number {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .smm-admin-container {
    margin: 10px 0;
    border-radius: 0;
  }
  
  .field-mega-menu {
    padding: 12px 15px !important;
  }
  
  .smm-builder-interface {
    padding: 15px;
  }
  
  .smm-summary-card {
    padding: 16px;
  }
  
  .smm-stats {
    flex-direction: column;
    gap: 8px;
  }
  
  .smm-stat {
    justify-content: center;
  }

  .smm-summary-actions .button {
    min-width: auto;
    width: 100%;
  }
  
  .smm-dialog-header {
    padding: 12px 16px;
  }
  
  .smm-dialog-columns {
    padding: 12px 16px;
  }
  
  .smm-column-blocks {
    padding: 12px;
  }
  
  .smm-block-content {
    padding: 12px 8px;
  }
}
