/* ==========================================================================
   SlideDiff Admin UI Styles
   Brand: Sattive Dev Labs
   ========================================================================== */

/* --- 1. Global Layout & Overrides --- */
#postbox-container-1 {
  display: block !important; /* Ensures the Sidebar is visible */
}

.postbox {
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
  border: 1px solid #e2e4e7;
  overflow: hidden;
}

.postbox-header {
  border-bottom: 1px solid #f0f0f0 !important;
  background: #fff !important;
}

.postbox-header h2 {
  font-weight: 600;
  color: #1d2327;
}

/* --- 2. Image Metabox (Before/After) --- */
.slidediff-meta-container {
  display: flex;
  gap: 20px;
  padding: 10px;
}

.slidediff-field {
  flex: 1;
  text-align: center;
  border: 2px dashed #dcdcde;
  padding: 20px;
  background: #fcfcfc;
  border-radius: 8px;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.slidediff-field:hover {
  background: #f3f4f5;
  border-color: #c3c4c7;
}

.slidediff-field h4 {
  margin-top: 0;
  color: #50575e;
  font-size: 14px;
}

.slidediff-preview {
  max-width: 100%;
  height: 160px;
  object-fit: contain;
  display: block;
  margin: 15px auto;
  background: #ebeced;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* --- 3. Grid & Typography --- */
.sd-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  padding: 10px;
}

.sd-label {
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
  color: #1d2327;
  font-size: 13px;
}

.sd-desc {
  font-size: 12px;
  color: #646970;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* --- 4. Inputs & Forms --- */
.sd-input-text,
.sd-select,
.sd-input {
  width: 100%;
  padding: 6px 12px;
  border: 1px solid #8c8f94;
  border-radius: 4px;
  box-shadow: 0 0 0 transparent;
  transition: border-color 0.1s ease;
}

.sd-input-text:focus,
.sd-select:focus,
.sd-input:focus {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px #2271b1;
  outline: none;
}

/* --- 5. Segmented Controls (Radio Buttons) --- */
.sd-segmented-control {
  display: inline-flex;
  border: 1px solid #8c8f94;
  border-radius: 4px;
  overflow: hidden;
}

.sd-segmented-control input {
  display: none;
}

.sd-segmented-control label {
  padding: 6px 20px;
  cursor: pointer;
  background: #fff;
  color: #50575e;
  font-weight: 500;
  transition: all 0.2s ease;
  border-right: 1px solid #dcdcde;
}

.sd-segmented-control label:last-child {
  border-right: none;
}

.sd-segmented-control input:checked + label {
  background: #2271b1;
  color: #fff;
  border-color: #2271b1;
}

/* --- 6. Custom Toggle Switch --- */
.sd-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.sd-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sd-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #a7aaad;
  transition: 0.3s ease;
  border-radius: 34px;
}

.sd-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sd-switch input:checked + .sd-slider {
  background-color: #2271b1;
}

.sd-switch input:checked + .sd-slider:before {
  transform: translateX(20px);
}

/* --- 7. Handle Selection Cards --- */
.sd-handle-options {
  display: flex;
  gap: 12px;
}

.sd-handle-card {
  flex: 1;
  border: 2px solid #dcdcde;
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  color: #50575e;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sd-handle-card:hover {
  border-color: #a7aaad;
}

.sd-handle-card.active {
  border-color: #2271b1;
  background: #f0f6fc;
  color: #1d2327;
}

.sd-handle-card input {
  display: none;
}

/* --- 8. Sidebar Design Settings --- */
.sd-design-sidebar {
  padding: 5px 0;
}

.sd-design-item {
  margin-bottom: 20px;
}

.sd-design-item:last-child {
  margin-bottom: 0;
}

.wp-picker-container {
  display: flex;
  align-items: center;
}

/* --- 9. Pinned Admin Footer --- */
.sd-admin-footer {
  margin-top: 30px;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.sd-status-text {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #50575e;
  font-weight: 500;
}

.sd-status-text .dashicons {
  color: #2271b1;
}

.sd-admin-footer #publish {
  height: 42px;
  padding: 0 32px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 4px;
}

/* ==========================================================================
   Design & Colors Metabox (Sidebar Strict Overrides)
   ========================================================================== */
.sd-design-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  padding: 5px 0 !important;
}

.sd-design-item {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Style the Labels */
.sd-design-item label {
  display: block !important;
  font-weight: 600 !important;
  margin-bottom: 8px !important;
  color: #1d2327 !important;
  font-size: 13px !important;
}

/* Override the WordPress Color Picker Container */
.sd-design-item .wp-picker-container {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

/* 1. The visual color swatch button */
.sd-design-item .wp-color-result.button {
  margin: 0 !important;
  border-radius: 4px !important;
  border: 1px solid #8c8f94 !important;
  box-shadow: none !important;
  height: 32px !important;
  min-height: 32px !important;
}

/* 2. The hex code text input field */
.sd-design-item .wp-picker-input-wrap input[type="text"] {
  padding: 0 8px !important;
  height: 32px !important;
  line-height: 32px !important;
  border: 1px solid #8c8f94 !important;
  border-radius: 4px !important;
  font-family: monospace !important;
  font-size: 12px !important;
  color: #3c434a !important;
  width: 85px !important; /* Kept compact for the sidebar */
  box-shadow: none !important;
  transition: border-color 0.1s ease !important;
}

.sd-design-item .wp-picker-input-wrap input[type="text"]:focus {
  border-color: #2271b1 !important;
  box-shadow: 0 0 0 1px #2271b1 !important;
  outline: none !important;
}

/* 3. The 'Default' / 'Clear' Button */
.sd-design-item .wp-picker-default {
  padding: 0 10px !important;
  height: 32px !important;
  line-height: 30px !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  border: 1px solid #dcdcde !important;
  background: #f6f7f7 !important;
  color: #2271b1 !important;
}

.sd-design-item .wp-picker-default:hover {
  background: #f0f0f1 !important;
  border-color: #c3c4c7 !important;
}

/* ==========================================================================
   Performance & SEO Settings Layout
   ========================================================================== */

.sd-settings-wrapper {
  padding: 10px 0 !important;
}

/* Row Layout */
.sd-settings-row {
  display: flex !important;
  align-items: center !important;
  padding: 15px 0 !important;
  border-bottom: 1px solid #f0f0f1 !important;
}

/* Align top for the Alt Text row to match the dual inputs */
.sd-settings-row[style*="align-items: flex-start"] {
  align-items: flex-start !important;
}

.sd-settings-row:last-of-type {
  border-bottom: none !important;
}

/* Label Column */
.sd-settings-row .sd-label {
  width: 200px !important;
  flex-shrink: 0 !important;
  font-weight: 600 !important;
  color: #1d2327 !important;
  font-size: 13px !important;
}

/* Field Column */
.sd-settings-row .sd-field {
  flex: 1 !important;
  display: flex !important;
  gap: 15px !important;
  align-items: center !important;
}

/* ==========================================================================
   Strict Input Overrides
   ========================================================================== */

/* Select Dropdown */
.sd-settings-wrapper .sd-select {
  max-width: 320px !important;
  width: 100% !important;
  padding: 6px 12px !important;
  border: 1px solid #8c8f94 !important;
  border-radius: 4px !important;
  background-color: #fff !important;
  box-shadow: none !important;
  color: #2c3338 !important;
  line-height: 1.5 !important;
  min-height: 32px !important;
  font-size: 13px !important;
  transition: border-color 0.1s ease !important;
}

/* Text Inputs (Alt Text) */
.sd-settings-wrapper .sd-input {
  flex: 1 !important; /* Makes both inputs take equal space side-by-side */
  min-width: 150px !important;
  padding: 6px 12px !important;
  border: 1px solid #8c8f94 !important;
  border-radius: 4px !important;
  background-color: #fff !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03) !important;
  color: #2c3338 !important;
  line-height: 1.5 !important;
  font-size: 13px !important;
  transition: border-color 0.1s ease !important;
}

/* Input Focus States */
.sd-settings-wrapper .sd-select:focus,
.sd-settings-wrapper .sd-input:focus {
  border-color: #2271b1 !important;
  box-shadow: 0 0 0 1px #2271b1 !important;
  outline: none !important;
}

/* ==========================================================================
   Configuration Metabox Styles (Strict Override)
   ========================================================================== */

/* Grid Layout */
.sd-settings-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 25px 20px !important;
  padding: 10px 0 !important;
}

.sd-field-group {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
}

.sd-label {
  font-weight: 600 !important;
  color: #1d2327 !important;
  margin-bottom: 8px !important;
  display: block !important;
  font-size: 13px !important;
}

/* --- Segmented Control (Orientation Radio Buttons) --- */
.sd-segmented-control {
  display: inline-flex !important;
  border: 1px solid #8c8f94 !important;
  border-radius: 4px !important;
  overflow: hidden !important;
  width: fit-content !important;
  background: #fff !important;
}

.sd-segmented-control input[type="radio"] {
  display: none !important;
}

.sd-segmented-control label {
  padding: 6px 20px !important;
  margin: 0 !important;
  cursor: pointer !important;
  background: #fff !important;
  color: #50575e !important;
  font-weight: 500 !important;
  border-right: 1px solid #8c8f94 !important;
  transition:
    background 0.2s ease,
    color 0.2s ease !important;
  line-height: 1.5 !important;
}

.sd-segmented-control label:last-of-type {
  border-right: none !important; /* Removes double border on the right */
}

.sd-segmented-control input[type="radio"]:checked + label {
  background: #2271b1 !important;
  color: #fff !important;
}

/* --- Range Slider (Starting Position) --- */
.sd-range {
  width: 100% !important;
  margin-top: 5px !important;
  cursor: pointer !important;
  accent-color: #2271b1 !important; /* Modern way to color range sliders */
}

.sd-range-val {
  color: #2271b1 !important;
  font-weight: 700 !important;
  margin-left: 5px !important;
  display: inline-block !important;
}

/* --- Text Inputs & Select Dropdown --- */
.sd-input-text {
  width: 100% !important;
  padding: 6px 12px !important;
  border: 1px solid #8c8f94 !important;
  border-radius: 4px !important;
  background: #fff !important;
  color: #3c434a !important;
  font-size: 13px !important;
  min-height: 32px !important;
  line-height: 1.5 !important;
  box-shadow: none !important;
  transition:
    border-color 0.1s ease,
    box-shadow 0.1s ease !important;
  box-sizing: border-box !important;
}

/* Specific styling for the flex container holding the two text inputs */
.sd-field-group > div[style*="display: flex"] {
  display: flex !important;
  gap: 10px !important;
  width: 100% !important;
}

/* Select Dropdown Specifics */
select.sd-input-text {
  cursor: pointer !important;
  appearance: auto !important; /* Ensures the dropdown arrow appears */
  max-width: 100% !important;
}

/* Focus States for Inputs */
.sd-input-text:focus {
  border-color: #2271b1 !important;
  box-shadow: 0 0 0 1px #2271b1 !important;
  outline: none !important;
}

/* ==========================================================================
   Force 100% Full-Width Layout
   ========================================================================== */
#post-body.columns-2 {
  margin-right: 0 !important; /* Removes the blank space on the right */
}

#post-body.columns-2 #postbox-container-2 {
  width: 100% !important; /* Forces the main section to 100% width */
  max-width: 100% !important;
}

#postbox-container-1 {
  display: none !important; /* Completely hides the sidebar container */
}
