/**
 * TFV3 Plato form visual layer.
 *
 * Scope:
 * - Nuevo plato
 * - Editar plato
 *
 * No selectors from other views.
 */

.tf-plato-editor-page {
  max-width: min(1120px, calc(100vw - 32px));
  margin: 24px auto 48px;
  padding: clamp(16px, 2vw, 30px);
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
}

.tf-plato-editor-page .entry-header {
  margin: 0 0 22px;
  padding-bottom: 17px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.tf-plato-editor-page .entry-title {
  margin: 0;
  color: #111827;
  font-size: clamp(27px, 3vw, 40px);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.tf-plato-editor-page .tf-form-notice {
  margin: 0 0 18px;
  padding: 13px 16px;
  border-radius: 15px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: #fff;
  color: #111827;
  font-weight: 680;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
}

.tf-plato-editor-page .tf-form-notice--success {
  border-color: rgba(22, 163, 74, 0.32);
  background: #f0fdf4;
}

.tf-plato-editor-page .tf-form-notice--error {
  border-color: rgba(220, 38, 38, 0.32);
  background: #fef2f2;
}

.tf-plato-form {
  display: grid;
  gap: 18px;
}

.tf-plato-form .tf-form-section {
  margin: 0 !important;
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.045);
}

.tf-plato-form .tf-form-section h2 {
  margin: 0 0 15px;
  color: #111827;
  font-size: 18px;
  font-weight: 850;
  line-height: 1.2;
}

.tf-plato-form .tf-form-section p {
  margin: 0 0 16px;
}

.tf-plato-form .tf-form-section p:last-child {
  margin-bottom: 0;
}

.tf-plato-form label strong {
  display: inline-block;
  margin-bottom: 7px;
  color: #111827;
  font-size: 14px;
  font-weight: 780;
}

.tf-plato-form input[type="text"],
.tf-plato-form input[type="search"],
.tf-plato-form input[type="number"],
.tf-plato-form textarea,
.tf-plato-form select {
  width: 100% !important;
  max-width: none !important;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 13px;
  background: #fff;
  color: #111827;
  font-size: 15px;
  line-height: 1.3;
  box-sizing: border-box;
  box-shadow: none;
}

.tf-plato-form input[type="text"]:focus,
.tf-plato-form input[type="search"]:focus,
.tf-plato-form input[type="number"]:focus,
.tf-plato-form textarea:focus,
.tf-plato-form select:focus {
  outline: 3px solid rgba(244, 81, 30, 0.18);
  border-color: #f4511e;
}

.tf-plato-form .tf-check-group {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px 12px;
  margin-top: 10px;
}

.tf-plato-form .tf-check-group label {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  margin: 0 !important;
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.tf-plato-form .tf-check-group label:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: translateY(-1px);
}

.tf-plato-form .tf-check-group label:has(input:checked) {
  border-color: rgba(244, 81, 30, 0.45);
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(244, 81, 30, 0.08);
}

.tf-plato-form .tf-check-group input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 1px 0 0 !important;
}

.tf-plato-form .tf-extra-alergenos {
  margin-top: 22px !important;
  padding-top: 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.tf-plato-form .tf-extra-alergeno-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px !important;
  align-items: center !important;
  margin: 10px 0 !important;
}

.tf-plato-form .tf-extra-alergeno-row button,
.tf-plato-form .tf-extra-alergeno-row .button {
  white-space: nowrap;
}

.tf-plato-form .tf-form-actions {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  margin-top: 0 !important;
  padding: 4px 0 0;
}

.tf-plato-form .tf-form-actions .button,
.tf-plato-form .tf-form-actions .button-primary,
.tf-plato-form button.button,
.tf-plato-form a.button {
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 780;
  line-height: 1.2;
}

.tf-plato-form .tf-form-actions .button-primary {
  box-shadow: 0 10px 22px rgba(244, 81, 30, 0.20);
}

.tf-plato-form .tf-form-actions a:not(.button) {
  color: #334155;
  font-weight: 720;
  text-decoration: none;
}

.tf-plato-form .tf-form-actions a:not(.button):hover {
  color: #111827;
  text-decoration: underline;
}

@media (max-width: 720px) {
  .tf-plato-editor-page {
    max-width: calc(100vw - 18px);
    margin-top: 12px;
    margin-bottom: 28px;
    padding: 14px;
    border-radius: 18px;
  }

  .tf-plato-editor-page .entry-header {
    margin-bottom: 16px;
  }

  .tf-plato-form {
    gap: 14px;
  }

  .tf-plato-form .tf-check-group {
    grid-template-columns: 1fr;
  }

  .tf-plato-form .tf-extra-alergeno-row {
    grid-template-columns: 1fr;
  }

  .tf-plato-form .tf-form-actions {
    align-items: stretch;
  }

  .tf-plato-form .tf-form-actions .button,
  .tf-plato-form .tf-form-actions .button-primary,
  .tf-plato-form .tf-form-actions a.button {
    width: 100%;
    text-align: center;
  }
}

/* === TFV3 NUEVO PLATO VISUAL REFINEMENT START === */
/*
 * Scope: Nuevo Plato only.
 * CRUD and WPML have already been validated.
 * Do not use this block for Mis Platos, Editar Plato, Centro planner or legacy fit-screen module.
 */

body.page-template-page-nuevo-plato .inside-article.tf-plato-editor-page,
body.page-template-page-nuevo-plato .tf-plato-editor-page {
    width: min(1120px, calc(100% - 32px));
    margin: 32px auto 42px;
    padding: clamp(22px, 3vw, 34px);
    border: 1px solid rgba(39, 45, 55, 0.08);
    border-radius: 28px;
    background:
        radial-gradient(circle at top left, rgba(250, 145, 32, 0.10), transparent 34%),
        linear-gradient(180deg, #fffdf9 0%, #f7f3eb 100%);
    box-shadow: 0 22px 60px rgba(40, 32, 20, 0.10);
}

body.page-template-page-nuevo-plato .tf-plato-editor-page .entry-header,
body.page-template-page-nuevo-plato .tf-plato-editor-page > header {
    margin: 0 0 24px;
    padding: 0;
}

body.page-template-page-nuevo-plato .tf-plato-editor-page h1 {
    margin: 0;
    color: #35251b;
    font-family: Montserrat, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(30px, 4vw, 46px);
    font-weight: 800;
    line-height: 1.06;
    letter-spacing: -0.035em;
}

body.page-template-page-nuevo-plato .tf-plato-form {
    display: grid;
    gap: 22px;
    margin: 0;
}

body.page-template-page-nuevo-plato .tf-plato-form fieldset,
body.page-template-page-nuevo-plato .tf-plato-form .tf-form-section,
body.page-template-page-nuevo-plato .tf-plato-form .tf-card,
body.page-template-page-nuevo-plato .tf-plato-form .tf-form-card {
    margin: 0;
    padding: clamp(18px, 2.4vw, 28px);
    border: 1px solid rgba(39, 45, 55, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 12px 30px rgba(40, 32, 20, 0.07);
}

body.page-template-page-nuevo-plato .tf-plato-form legend,
body.page-template-page-nuevo-plato .tf-plato-form h2,
body.page-template-page-nuevo-plato .tf-plato-form h3 {
    margin: 0 0 16px;
    color: #3b2a1e;
    font-family: Montserrat, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(19px, 2.2vw, 24px);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -0.02em;
}

body.page-template-page-nuevo-plato .tf-plato-form p,
body.page-template-page-nuevo-plato .tf-plato-form .description,
body.page-template-page-nuevo-plato .tf-plato-form small {
    color: #675a4d;
    font-size: 14px;
    line-height: 1.55;
}

body.page-template-page-nuevo-plato .tf-plato-form label {
    color: #403328;
    font-weight: 700;
    line-height: 1.35;
}

body.page-template-page-nuevo-plato .tf-plato-form input[type="text"],
body.page-template-page-nuevo-plato .tf-plato-form input[type="search"],
body.page-template-page-nuevo-plato .tf-plato-form input[type="number"],
body.page-template-page-nuevo-plato .tf-plato-form textarea,
body.page-template-page-nuevo-plato .tf-plato-form select {
    width: 100%;
    min-height: 48px;
    margin-top: 7px;
    border: 1px solid rgba(63, 49, 36, 0.16);
    border-radius: 14px;
    background: #ffffff;
    color: #2f271f;
    font-size: 15px;
    line-height: 1.4;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

body.page-template-page-nuevo-plato .tf-plato-form input[type="text"]:focus,
body.page-template-page-nuevo-plato .tf-plato-form input[type="search"]:focus,
body.page-template-page-nuevo-plato .tf-plato-form input[type="number"]:focus,
body.page-template-page-nuevo-plato .tf-plato-form textarea:focus,
body.page-template-page-nuevo-plato .tf-plato-form select:focus {
    border-color: #f18a1f;
    background: #fffefa;
    box-shadow: 0 0 0 4px rgba(241, 138, 31, 0.16);
    outline: none;
}

body.page-template-page-nuevo-plato .tf-plato-form .tf-check-grid,
body.page-template-page-nuevo-plato .tf-plato-form .tf-checkbox-grid,
body.page-template-page-nuevo-plato .tf-plato-form .tfv3-checkbox-grid,
body.page-template-page-nuevo-plato .tf-plato-form .alergenos-grid,
body.page-template-page-nuevo-plato .tf-plato-form .ingestas-grid,
body.page-template-page-nuevo-plato .tf-plato-form .checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

body.page-template-page-nuevo-plato .tf-plato-form .tf-check-grid label,
body.page-template-page-nuevo-plato .tf-plato-form .tf-checkbox-grid label,
body.page-template-page-nuevo-plato .tf-plato-form .tfv3-checkbox-grid label,
body.page-template-page-nuevo-plato .tf-plato-form .alergenos-grid label,
body.page-template-page-nuevo-plato .tf-plato-form .ingestas-grid label,
body.page-template-page-nuevo-plato .tf-plato-form .checkbox-grid label,
body.page-template-page-nuevo-plato .tf-plato-form label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    margin: 0;
    padding: 11px 13px;
    border: 1px solid rgba(63, 49, 36, 0.12);
    border-radius: 14px;
    background: #fffaf3;
    color: #403328;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(40, 32, 20, 0.045);
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

body.page-template-page-nuevo-plato .tf-plato-form label:has(input[type="checkbox"]:checked) {
    border-color: rgba(224, 118, 20, 0.70);
    background: #fff2df;
    box-shadow: 0 8px 18px rgba(224, 118, 20, 0.12);
}

body.page-template-page-nuevo-plato .tf-plato-form label:has(input[type="checkbox"]):hover {
    transform: translateY(-1px);
    border-color: rgba(224, 118, 20, 0.44);
    background: #fff6ea;
}

body.page-template-page-nuevo-plato .tf-plato-form input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: #e67814;
}

body.page-template-page-nuevo-plato .tf-plato-form .tf-bulk-actions,
body.page-template-page-nuevo-plato .tf-plato-form .tf-check-actions,
body.page-template-page-nuevo-plato .tf-plato-form .tf-section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 14px;
}

body.page-template-page-nuevo-plato .tf-plato-form .button,
body.page-template-page-nuevo-plato .tf-plato-form button,
body.page-template-page-nuevo-plato .tf-plato-form input[type="submit"] {
    min-height: 44px;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

body.page-template-page-nuevo-plato .tf-plato-form .button:not(.button-primary),
body.page-template-page-nuevo-plato .tf-plato-form button:not([type="submit"]) {
    border: 1px solid rgba(63, 49, 36, 0.14);
    background: #fff9f0;
    color: #5b3a1f;
}

body.page-template-page-nuevo-plato .tf-plato-form .button-primary,
body.page-template-page-nuevo-plato .tf-plato-form button[type="submit"],
body.page-template-page-nuevo-plato .tf-plato-form input[type="submit"] {
    border: 0;
    background: linear-gradient(135deg, #ef7f1a 0%, #d95c0b 100%);
    color: #fff;
    box-shadow: 0 12px 28px rgba(217, 92, 11, 0.26);
}

body.page-template-page-nuevo-plato .tf-plato-form .tf-extra-row,
body.page-template-page-nuevo-plato .tf-plato-form .tfv3-other-allergen-row,
body.page-template-page-nuevo-plato .tf-plato-form .tf-other-allergen-row,
body.page-template-page-nuevo-plato .tf-plato-form .otros-alergenos-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 12px;
    padding: 14px;
    border: 1px dashed rgba(63, 49, 36, 0.18);
    border-radius: 16px;
    background: #fffaf3;
}

body.page-template-page-nuevo-plato .tf-plato-form .tf-form-actions,
body.page-template-page-nuevo-plato .tf-plato-form .tfv3-form-actions,
body.page-template-page-nuevo-plato .tf-plato-form p:has(button[type="submit"]),
body.page-template-page-nuevo-plato .tf-plato-form p:has(input[type="submit"]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 6px;
}

body.page-template-page-nuevo-plato .tf-form-notice {
    margin: 0 0 18px;
    border-radius: 16px;
    border: 1px solid rgba(63, 49, 36, 0.12);
    box-shadow: 0 10px 24px rgba(40, 32, 20, 0.06);
}

body.page-template-page-nuevo-plato .tf-form-notice p {
    margin: 0;
}

@media (max-width: 780px) {
    body.page-template-page-nuevo-plato .inside-article.tf-plato-editor-page,
    body.page-template-page-nuevo-plato .tf-plato-editor-page {
        width: min(100% - 18px, 1120px);
        margin: 18px auto 30px;
        padding: 16px;
        border-radius: 20px;
    }

    body.page-template-page-nuevo-plato .tf-plato-form {
        gap: 16px;
    }

    body.page-template-page-nuevo-plato .tf-plato-form fieldset,
    body.page-template-page-nuevo-plato .tf-plato-form .tf-form-section,
    body.page-template-page-nuevo-plato .tf-plato-form .tf-card,
    body.page-template-page-nuevo-plato .tf-plato-form .tf-form-card {
        padding: 16px;
        border-radius: 18px;
    }

    body.page-template-page-nuevo-plato .tf-plato-form .tf-check-grid,
    body.page-template-page-nuevo-plato .tf-plato-form .tf-checkbox-grid,
    body.page-template-page-nuevo-plato .tf-plato-form .tfv3-checkbox-grid,
    body.page-template-page-nuevo-plato .tf-plato-form .alergenos-grid,
    body.page-template-page-nuevo-plato .tf-plato-form .ingestas-grid,
    body.page-template-page-nuevo-plato .tf-plato-form .checkbox-grid {
        grid-template-columns: 1fr;
    }

    body.page-template-page-nuevo-plato .tf-plato-form .tf-extra-row,
    body.page-template-page-nuevo-plato .tf-plato-form .tfv3-other-allergen-row,
    body.page-template-page-nuevo-plato .tf-plato-form .tf-other-allergen-row,
    body.page-template-page-nuevo-plato .tf-plato-form .otros-alergenos-row {
        grid-template-columns: 1fr;
    }

    body.page-template-page-nuevo-plato .tf-plato-form .tf-form-actions,
    body.page-template-page-nuevo-plato .tf-plato-form .tfv3-form-actions,
    body.page-template-page-nuevo-plato .tf-plato-form p:has(button[type="submit"]),
    body.page-template-page-nuevo-plato .tf-plato-form p:has(input[type="submit"]) {
        align-items: stretch;
        flex-direction: column;
    }

    body.page-template-page-nuevo-plato .tf-plato-form .button,
    body.page-template-page-nuevo-plato .tf-plato-form button,
    body.page-template-page-nuevo-plato .tf-plato-form input[type="submit"] {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}
/* === TFV3 NUEVO PLATO VISUAL REFINEMENT END === */
