/**
 * Admin CSS — Settings & Style tabs
 *
 * Provides the styles for the Menu d’Ancrage plugin administration interface,
 * including the Settings form (per-page) and the Style customization tab.
 *
 * @package anchorflow-menu
 * @since 1.0.0
 */

/**
 * 1.0 Main settings wrapper
 *
 */

.menu-ancrage-form-wrapper {
  background: #f6f7f7;
  border: 1px solid #66a2e0;
  border-radius: 6px;
  padding: 8px 24px 24px;
  margin-top: 20px;
  box-shadow: 0 1px 3px rgba(31, 93, 170, 0.15);
}

/**
 * 2.0 Option group blocks
 */

.menu-ancrage-reglage-group {
  background-color: #ffffff;
  border: 1px solid #1f5daa;
  padding: 20px;
  margin-top: 16px;
  margin-bottom: 16px;
  border-radius: 8px;
}

.menu-ancrage-reglage-group h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 18px;
  color: #1f5daa;
}

/* Prevents unwanted margins at the bottom of the last paragraph */
.menu-ancrage-reglage-group > p:last-of-type {
  margin-bottom: 4px;
  color: #222222;
}

/* Natural spacing between two consecutive groups */
.menu-ancrage-reglage-group + .menu-ancrage-reglage-group {
  margin-top: 24px;
}

/* Specific group for the mobile option */
.menu-ancrage-reglage-group.menu-ancrage-mobile-box {
  padding: 10px 20px;
  margin-bottom: 20px;
}

/**
 * 3.0 Display options (checkbox group)
 *
 * Layout and spacing for the checkbox options group.
 */

/* Container: align checkboxes side by side */
.menu-ancrage-display-box fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 12px; /* only a small gap between them */
  align-items: center;
}

/* Each option (checkbox + label text) */
.menu-ancrage-display-box label {
  display: flex;
  align-items: center; 
  gap: 6px;
  flex: 0 0 auto;
  /* shrink to fit content, no stretching */
  margin: 0;
  /* No extra margin */
  font-size: 14px;
  line-height: 1.2;
}

/* Checkbox itself */
.menu-ancrage-display-box input[type="checkbox"] {
  flex-shrink: 0;
  margin: 0;
}

/* Mobile: stack checkboxes vertically */
@media (max-width: 768px) {
  .menu-ancrage-display-box fieldset {
    flex-direction: column;
    align-items: flex-start;
  }
}

/**
 * 4.0 Title row: heading tag + menu title
 *
 * Layout for the title row containing the heading tag selector and the menu title field.
 */

.menu-ancrage-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
}

.menu-ancrage-title-row label,
.menu-ancrage-label {
  font-weight: 600;
  font-size: 14px;
  color: #222222;
  display: block;
  margin-bottom: 6px;
}

.menu-ancrage-title-row select,
.menu-ancrage-title-row input[type="text"] {
  padding: 7px 10px;
  font-size: 14px;
  border: 1px solid #66a2e0;
  border-radius: 5px;
  height: 38px;
  background-color: #ffffff;
  width: 220px;
  margin-bottom: 0;
}


/**
 * 5.0 Preview notice spacing fix
 *
 * Removes unwanted margin at the top of the preview notice when it is the first element.
 */

.menu-ancrage-reglage-group .menu-ancrage-preview-notice:first-child {
  margin-top: 0;
}

/**
 * 6.0 Mobile bar option checkbox
 *
 * Spacing and layout for the checkbox controlling the mobile bar activation.
 */

.menu-ancrage-option-block {
  margin-bottom: 20px;
  padding: 10px 0;
}

/**
 * 7.0 Custom link fields
 *
 * Layout for the draggable custom link rows.
 */

/* Group container */
#menu-ancrage-fields {
  margin-bottom: 20px;
}

/* Row: drag handle + inputs + ✕ button */
.menu-field-row {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Drag handle */
.drag-handle {
  cursor: move;
  font-size: 22px;
  color: #1f5daa;
  user-select: none;
  margin-right: 12px;
}

.drag-handle:focus {
  outline: 2px solid #1f5daa;
  outline-offset: 2px;
  border-radius: 4px;
}


/* Text inputs (label and anchor) */
.menu-field-row input[type="text"] {
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #66a2e0;
  border-radius: 3px;
  box-sizing: border-box;
  width: 45%;
  margin-right: 10px;
}

/* ✕ Remove button */
.menu-field-row button.remove-row {
  background: transparent;
  border: none;
  color: #d33;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
  margin-left: 10px;
  padding: 0;
  line-height: 1;
}

/* Placeholder while dragging */
.sortable-placeholder {
  background: #e0e0e0;
  border: 2px dashed #999;
  height: 42px;
  margin: 8px 0;
  border-radius: 4px;
  box-sizing: border-box;
}

/**
 * 8.0 Error handling (inputs and messages)
 *
 * Styles for error borders, error messages, and error indicators.
 */

/* Red border when a field has an error */
.menu-field-row.menu-ancrage-error input {
  border: 2px solid #d63638;
  background-color: #fff5f5;
}

/* Error message box */
.menu-ancrage-notice-error {
  background-color: #fbeaea;
  border-left: 4px solid #d63638;
  padding: 6px 10px;
  margin-left: 10px;
  color: #a94442;
  font-size: 13px;
  font-weight: normal;
  border-radius: 4px;
  max-width: 300px;
  display: inline-block;
  vertical-align: middle;
}

/* Error line (optional number) */
.menu-ancrage-error-line {
  font-weight: bold;
  color: #d63638;
  margin-bottom: 6px;
}

/**
 * 9.0 Success / validation messages
 *
 * Styles for success notices (green/blue validation messages).
 */

.menu-ancrage-notice-updated {
  background-color: #e7f1fa;
  border-left: 6px solid #1f5daa;
  padding: 8px 12px;
  margin-bottom: 5px;
  color: #1f5daa;
  font-weight: 600;
  border-radius: 4px;
  max-width: 400px;
  display: inline-block;
  vertical-align: top;
}

/**
 * 10.0 "Add link" button
 *
 * Styles for the button that adds a new custom link row.
 */

#add-menu-field {
  margin-bottom: 4px;
}

/**
 * 11.0 Empty state message
 *
 * Styles for the message displayed when no page is selected.
 */

.menu-ancrage-empty-state {
  margin: 25px auto;
  padding: 20px 25px;
  background-color: #fdfdfd;
  /* ou #f8fafd pour un ton + doux */
  border: 1px solid #ccd0d4;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  color: #333333;
  max-width: 700px;
  width: 100%;
  text-align: left;
}

.menu-ancrage-empty-state h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 20px;
  color: #1f5daa;
  line-height: 1.3;
  font-weight: 600;
  /* pour mieux ressortir */
}

.menu-ancrage-empty-state p {
  margin: 6px 0;
  font-size: 15px;
  line-height: 1.7;
  color: #333333;
  /* un peu plus contrasté que #444 */
}

/**
 * 12.0 Responsive layout (mobile < 640px)
 *
 * Mobile optimizations for title rows, fields, and input layout.
 */

/* Title and heading tag aligned vertically on small screens */

@media (max-width: 640px) {
  .menu-ancrage-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .menu-ancrage-title-row select,
  .menu-ancrage-title-row input[type="text"] {
    width: 100%;
  }
}

/* Link fields stacked vertically  */
@media (max-width: 640px) {
  .menu-field-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .menu-field-row input[type="text"] {
    width: 100%;
  }

  .menu-field-row button.remove-row {
    align-self: flex-end;
  }

  /* Hide desktop version of errors, show mobile version */
  .menu-field-row .desktop-only {
    display: none;
  }

  .menu-field-row .mobile-only {
    display: block;
    margin-top: 6px;
  }
}

/**
 * 13.0 Conditional visibility (desktop vs mobile)
 *
 * Controls which elements are shown on desktop vs mobile.
 */

.desktop-only {
  display: inline-block;
}

/* Hidden by default (desktop) */
.mobile-only {
  display: none;
}

@media (max-width: 640px) {
  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
    margin-top: 4px;
  }
}

/**
 * 14.0 General container
 *
 * Visual grouping block with background, border, spacing and rounded corners.
 */

.menu-ancrage-settings-group {
  display: block;
  background-color: #f9f9f9;
  border: 1px solid #66a2e0;
  padding: 20px;
  margin-top: 25px;
  margin-bottom: 30px;
  border-radius: 8px;
}

/* Alternance de couleur claire/foncée */
.menu-ancrage-settings-group:nth-of-type(even) {
  background-color: #E9F1FA;
}

/**
 * 15.0 Page selector
 *
 * Styles for the per-page dropdown.
 */

.menu-ancrage-reglage-group #menu_ancrage_selected_page {
  width: 100%;
  max-width: 520px;
  padding: 7px 10px;
  font-size: 14px;
  color: #1d2327;
  background-color: #ffffff !important;
  border: 1px solid #66a2e0;
  border-radius: 6px;
}

.menu-ancrage-reglage-group #menu_ancrage_selected_page:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(31, 93, 170, .15);
}

.menu-ancrage-reglage-group #menu_ancrage_selected_page optgroup {
  color: #15457a !important;
  font-weight: 600;
  text-transform: uppercase;
}

.menu-ancrage-reglage-group #menu_ancrage_selected_page option {
  color: #1d2327;
}

.menu-ancrage-reglage-group #menu_ancrage_selected_page option[disabled] {
  color: #8a8f98;
}

/**
 * 16.0 Title row (title tag + title field)
 *
 * Layout for the heading tag selector and the title input.
 */

.menu-ancrage-settings-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
}

.menu-ancrage-settings-title-row label {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 6px;
  color: #1f5daa;
}

.menu-ancrage-settings-title-row select,
.menu-ancrage-settings-title-row input[type="text"] {
  padding: 7px 10px;
  font-size: 14px;
  border: 1px solid #66a2e0;
  border-radius: 4px;
  height: 38px;
  background-color: #ffffff;
}

/* Column containing the heading tag selector */
.menu-ancrage-settings-title-tag {
  flex: 0 0 150px;
}

/* Column containing the menu title input */
.menu-ancrage-settings-title-text {
  flex: 1;
  min-width: 200px;
}

/**
 * 17.0 Asterisk for required fields
 *
 * Styles for the red asterisk indicating required fields.
 */

.menu-ancrage-required {
  color: #d63638;
  margin-left: 4px;
  font-weight: bold;
  font-size: 16px;
  line-height: 1;
  vertical-align: middle;
}

/**
 * 18.0 Mobile option (checkbox)
 *
 * Styles for the checkbox that toggles the mobile anchor menu.
 */

.menu-ancrage-settings-mobile-option {
  margin-top: 15px;
  margin-bottom: 10px;
}

.menu-ancrage-settings-mobile-option label {
  font-size: 14px;
  color: #333333;
}

/**
 * 19.0 Settings buttons (save / reset)
 *
 * Styles for primary and secondary administration buttons.
 */

.menu-ancrage-settings-buttons {
  display: flex;
  gap: 20px;
  margin-top: 25px;
  flex-wrap: wrap;
}

.menu-ancrage-settings-buttons input[type="submit"] {
  padding: 6px 12px;
  font-size: 14px;
  min-width: 100px;
  margin-right: 8px;
  border-radius: 4px;
}

/* Primary button (main blue action button) */
.menu-ancrage-settings-buttons .button-primary {
  background-color: #1f5daa;
  border-color: #1f5daa;
  color: #ffffff;
}

/* Secondary button (neutral/reset action) */
.menu-ancrage-settings-buttons .button-secondary {
  background: #f0f2f5;
  color: #1F5DAA;
  border-color: #1f5daa;
}

.menu-ancrage-settings-buttons .button-secondary,
#add-menu-field.button-secondary {
  font-size: 14px !important;
  color: #1F5DAA;
}

/* Hover state for the primary button */
.menu-ancrage-settings-buttons .button-primary:hover {
  background-color: #174a88;
  border-color: #174a88;
}

/**
 * 20.0 Responsive adjustments (mobile)
 *
 * Layout corrections for small screens (≤ 640px).
 */

@media (max-width: 640px) {
  .menu-ancrage-settings-title-row {
    flex-direction: column;
  }

  .menu-ancrage-settings-title-tag,
  .menu-ancrage-settings-title-text {
    flex: 1 1 100%;
  }

  .menu-ancrage-settings-buttons {
    flex-direction: column;
    gap: 10px;
  }
}

/**
 * 21.0 Enhanced notices & shortcode block
 *
 * Styles for global success/error notices, admin instructions, the shortcode
 * display box, and the preview notice shown in settings pages.
 */

/* Common box */
.menu-ancrage-global-notice {
  padding: 12px 16px;
  border-left: 4px solid #1f5daa;
  border-radius: 6px;
  margin-top: 20px;
  margin-bottom: 25px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 720px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Success message*/
.menu-ancrage-global-notice.notice-success {
  background-color: #e7f7eb;
  border-left: 5px solid #46b450;
  color: #1d4021;
}

/* Error message */
.menu-ancrage-global-notice.notice-error {
  background-color: #fcebea;
  border-left: 5px solid #dc3232;
  color: #86181d;
}

/* Menu Anchor instructions */
.menu-ancrage-instructions {
  font-size: 13.5px;
  line-height: 1.5;
  color: #000000;
  margin: 0 0 12px;
}

/* ===  Shortcode insertion block [menu_ancrage] === */

/*  Shortcode box */
.menu-ancrage-shortcode-box {
  background: #f6f7f9;
  border: 1px solid #1f5daa;
  padding: 16px;
  margin-top: 24px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Intro closer to input */
.menu-ancrage-shortcode-intro {
  margin-bottom: 6px;
  font-size: 14px;
  color: #222222;
}

.menu-ancrage-shortcode-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* More compact input, reasonable max-width */
.menu-ancrage-shortcode-copy input[type="text"] {
  font-family: monospace;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  color: #333333;
  flex: 1 1 auto;
  max-width: 300px;
}

/* Subtle confirmation */
.menu-ancrage-copy-confirmation {
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 0.9em;
  color: #2271b1;
  font-weight: 600;
}

.menu-ancrage-copy-confirmation.is-visible {
  opacity: 1;
}

.anchor-menu-shortcode-note {
  font-size: 14px;
  line-height: 1.5;
  color: #23282d;
}

/* Info message in preview mode */
.menu-ancrage-preview-notice {
  background: #fefefe;
  border-left: 4px solid #0073aa;
  padding: 12px 16px;
  margin-top: 24px;
  /* plus d’espace au-dessus */
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: #23282d;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-ancrage-preview-notice::before {
  content: "👁️";
  font-size: 18px;
  flex-shrink: 0;
}

/**
 * 22.0 Styles for the “Style” tab of the Anchor Menu plugin
 *
 * Visual styles for the appearance customization screen.
 */

/* Main navigation tabs (Settings / Style) */
.nav-tab-wrapper {
  margin-bottom: 28px;
}

.nav-tab {
  background: #f0f0f1;
  /* gris clair */
  color: #222;
  /* gris texte */
  border: 1px solid #c3c4c7;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
}

.nav-tab-active,
.nav-tab-active:hover,
.nav-tab-active:focus {
  background: #1f5daa;
  color: #ffffff;
  border-color: #1f5daa;
}

/* Style group (appearance section, title, links, etc.) */
.menu-ancrage-style-group {
  display: block;
  background-color: #FFFFFF;
  border: 1px solid #1f5daa;
  padding: 20px;
  margin-top: 30px;
  margin-bottom: 30px;
  border-radius: 8px;
}

/* Group title */
.menu-ancrage-style-group h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 18px;
  color: #003366;
}

/* Flex container for fields in each group */
.menu-ancrage-style-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

/* Field (label + input) */
.menu-ancrage-style-item {
  flex: 0 0 220px;
  display: flex;
  /* fixed width */
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
}

/* Label: spaced, readable */
.menu-ancrage-style-item label {
  font-weight: 600;
  font-size: 13.5px;
  color: #1f5daa;
}

/**
 * 23.0 Style tab inputs (Colors, Numbers, Selects)
 */

/* Force specific style for Number inputs to show arrows in Chrome/Safari */
.menu-ancrage-style-item input[type="number"] {
    -webkit-appearance: number-input !important;
    -moz-appearance: number-input !important;
    appearance: auto !important;
    padding: 7px 0 7px 10px !important;
    
    /* Layout */
    width: 100%;
    max-width: 220px;
    height: 38px;
    font-size: 14px;
    border: 1px solid #1f5daa;
    border-radius: 6px;
    background-color: #ffffff;
}

/* Force arrow visibility on Webkit browsers (Chrome, Edge, Safari) */
.menu-ancrage-style-item input[type="number"]::-webkit-inner-spin-button,
.menu-ancrage-style-item input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: inner-spin-button !important;
    opacity: 1 !important;
    display: block !important;
    height: 30px;
}

/* Standard styles for Color and Select inputs */
.menu-ancrage-style-item input[type="color"],
.menu-ancrage-style-item select {
    width: 100%;
    max-width: 220px;
    height: 38px;
    padding: 7px 10px;
    font-size: 14px;
    border: 1px solid #1f5daa;
    border-radius: 6px;
    background-color: #ffffff;
}

/* Responsive: fields stacked in column on small screens */
@media (max-width: 640px) {
  .menu-ancrage-style-fields {
    flex-direction: column;
  }

  .menu-ancrage-style-item {
    flex: 1 1 100%;
  }
}

/* === Welcome message (no page selected) === */
.menu-ancrage-empty-message {
  background-color: #f0f8ff;
  border-left: 4px solid #0073aa;
  padding: 15px 20px;
  margin: 20px 0;
  border-radius: 5px;
  color: #004d80;
  font-size: 15px;
  line-height: 1.5;
  max-width: 600px;
}

/* Warning: JavaScript disabled */
.menu-ancrage-noscript-warning {
  background-color: #fff3cd;
  color: #856404;
  padding: 1em;
  border: 1px solid #ffeeba;
  border-radius: 5px;
  font-size: 1rem;
  margin-top: 1.5em;
  text-align: center;
}

/* === Sub-tabs Desktop / Mobile in the Style tab === */

.menu-ancrage-style-subtabs {
  display: flex;
  gap: 12px;
  margin-top: 40px;
  margin-bottom: 25px;
  padding-left: 2px;
}

.menu-ancrage-style-subtabs .nav-subtab {
  font-size: 15px;
  background-color: #f9fafb;
  padding: 8px 16px;
  text-decoration: none;
  color: #1f5daa;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  box-shadow: inset 0 0 0 1px rgba(31, 93, 170, 0.05);
}

.menu-ancrage-style-subtabs .nav-subtab:focus-visible {
  outline: 2px solid #1f5daa;
  outline-offset: 2px;
  border-radius: 6px;
}

.menu-ancrage-style-subtabs .nav-subtab:hover:not(.nav-subtab-active) {
  background-color: #e0e7ef;
  border-color: #b3c7df;
}


.menu-ancrage-style-subtabs .nav-subtab-active {
  background-color: #1f5daa;
  color: #fff;
  border-color: #1f5daa;
}

.menu-ancrage-style-note {
  display: block;
  font-size: 15px;
  color: #222;
  margin-top: 2px;
}


/* FREEMIUM: Custom Pro notice */
.notice.menu-ancrage-pro-notice {
  border-left: 6px solid #d63638; 
  background: #eaf3fb;            
  border-radius: 6px;             
  padding: 12px 16px;
  margin-top: 16px;
}

.notice.menu-ancrage-pro-notice p {
  margin: 0;
  font-size: 16px !important;
  line-height: 1.5;
  color: #222222; 
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.notice.menu-ancrage-pro-notice a {
  color: #1f5daa !important;   
  background: #eaf3fb;         
  border: 2px solid #1f5daa;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.notice.menu-ancrage-pro-notice a:hover {
  background: #1f5daa;
  color: #fff !important;
}

/* FREEMIUM: Custom Pro active notice */
.notice.menu-ancrage-pro-active {
  border-left: 6px solid #1f5daa; 
  background: #f0f7ff;            
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 16px;
}

.notice.menu-ancrage-pro-active p {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: #222222;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice.menu-ancrage-pro-active .icon, .menu-ancrage-pro-notice .icon{
  font-size: 18px;
}
