/*
* Copyright 2017-present, Meta, Inc.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/

/* ========================================
   FBL4B Design Tokens (Meta Design System)
   ======================================== */
:root {
  /* Primary Colors */
  --fbl4b-primary-blue: #1877f2;
  --fbl4b-primary-blue-hover: #166fe5;
  --fbl4b-primary-blue-disabled: #a0c4e8;

  /* Text Colors */
  --fbl4b-text-primary: #1c2b33;
  --fbl4b-text-secondary: #606770;
  --fbl4b-text-white: #ffffff;

  /* Status Colors */
  --fbl4b-success-green: #2e7d32;
  --fbl4b-success-bg: #e8f5e9;
  --fbl4b-error-red: #f44336;
  --fbl4b-error-bg: #ffebee;
  --fbl4b-warning-yellow: #f9a825;
  --fbl4b-warning-bg: #fff8e1;

  /* Neutral Colors */
  --fbl4b-background-white: #ffffff;
  --fbl4b-background-gray: #f5f6f7;
  --fbl4b-border-color: #e4e6eb;
  --fbl4b-border-light: #ccd0d5;

  /* Elevation */
  --fbl4b-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --fbl4b-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);

  /* Typography */
  --fbl4b-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Spacing */
  --fbl4b-spacing-xs: 4px;
  --fbl4b-spacing-sm: 8px;
  --fbl4b-spacing-md: 12px;
  --fbl4b-spacing-lg: 16px;
  --fbl4b-spacing-xl: 24px;
  --fbl4b-spacing-xxl: 32px;

  /* Border Radius */
  --fbl4b-radius-sm: 4px;
  --fbl4b-radius-md: 6px;
  --fbl4b-radius-lg: 8px;
  --fbl4b-radius-xl: 12px;
  --fbl4b-radius-pill: 16px;
}

/* ========================================
   FBL4B Iframe Container
   ======================================== */
#fbe-iframe {
  background: var(--fbl4b-background-white);
  border: 1px solid var(--fbl4b-border-color);
  border-radius: var(--fbl4b-radius-xl);
  box-shadow: var(--fbl4b-shadow);
  overflow: hidden;
  margin: 20px 20px 20px 0;
}

#fbe-iframe iframe {
  border: none;
  border-radius: var(--fbl4b-radius-xl);
  display: block;
}

/* ========================================
   Legacy Styles (preserved)
   ======================================== */

/* ========================================
   FBL4B Disconnect Warning
   ======================================== */
.fbl4b-disconnect-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

.fbl4b-disconnect-warning-title {
  margin: 0 0 12px 0;
  color: #856404;
  font-size: 14px;
  font-weight: bold;
}

.fbl4b-disconnect-warning-steps {
  margin: 0;
  padding-left: 20px;
  color: #856404;
  font-size: 14px;
}

.fbl4b-disconnect-warning-steps li {
  margin-bottom: 8px;
}

.fbl4b-disconnect-warning-steps li:last-child {
  margin-bottom: 0;
}

/* ========================================
   FBL4B Admin Notices
   ======================================== */
.fbl4b-notice {
  position: relative;
  padding: 12px 40px 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--fbl4b-radius-md);
  font-size: 14px;
  font-family: var(--fbl4b-font-family);
}

.fbl4b-notice p {
  margin: 0;
}

.fbl4b-notice-error {
  background: var(--fbl4b-error-bg);
  border: 1px solid var(--fbl4b-error-red);
  color: #b71c1c;
}

.fbl4b-notice-success {
  background: var(--fbl4b-success-bg);
  border: 1px solid var(--fbl4b-success-green);
  color: #1b5e20;
}

.fbl4b-notice-warning {
  background: var(--fbl4b-warning-bg);
  border: 1px solid var(--fbl4b-warning-yellow);
  color: #856404;
}

.fbl4b-notice-dismiss {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0;
  line-height: 1;
}

.fbl4b-notice-dismiss:hover {
  opacity: 1;
}

/* ========================================
   FBL4B Connected State
   ======================================== */
.fbl4b-connected-container {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin: 20px 20px 20px 0px;
}

.fbl4b-connected-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e4e6eb;
  display: flex;
  align-items: center;
}

.fbl4b-connected-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fbl4b-connected-logo {
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

.fbl4b-connected-logo-text {
  color: #0866ff;
  font-size: 18px;
  font-weight: 500;
}

.fbl4b-connected-title {
  font-size: 18px;
  font-weight: 600;
  color: #1c2b33;
}

.fbl4b-connected-badge {
  background: #def7ec;
  color: #03543f;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fbl4b-connected-badge-setup {
  background: #fff8e1;
  color: #f57f17;
}

.fbl4b-connected-details {
  padding: 16px 24px;
  border-bottom: 1px solid #e4e6eb;
}

.fbl4b-connected-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.fbl4b-connected-row-border {
  border-bottom: 1px solid #f3f4f6;
}

.fbl4b-connected-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #374151;
}

.fbl4b-connected-label-icon-green {
  color: #1e7e34;
}

.fbl4b-connected-label-icon-warning {
  color: #f9a825;
}

.fbl4b-connected-value {
  font-weight: 600;
  color: #1c2b33;
}

.fbl4b-connected-section {
  padding: 24px;
  border-bottom: 1px solid #e4e6eb;
}

.fbl4b-connected-section-last {
  padding: 24px;
}

/* Connection Settings Accordion */
.fbl4b-connection-settings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 0;
  user-select: none;
}

.fbl4b-connection-settings-header:hover {
  color: #1877f2;
}

.fbl4b-connection-settings-title {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

.fbl4b-connection-settings-header:hover .fbl4b-connection-settings-title {
  color: #1877f2;
}

.fbl4b-connection-settings-arrow {
  font-size: 18px;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.fbl4b-connection-settings-body {
  margin-top: 20px;
}

.fbl4b-connection-settings-item {
  padding: 16px 0;
  border-top: 1px solid #f3f4f6;
}

.fbl4b-connection-settings-item:first-child {
  padding-top: 0;
  border-top: none;
}

.fbl4b-connected-section-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1c2b33;
}

.fbl4b-connected-section-desc {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
}

.fbl4b-connected-section-desc a {
  color: #1877f2;
  text-decoration: underline;
}

.fbl4b-btn-primary {
  background: #1877f2;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.fbl4b-btn-primary:hover {
  background: #166fe5;
}

.fbl4b-btn-primary.fbl4b-btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fbl4b-btn-primary.fbl4b-btn-disabled:hover {
  background: #1877f2;
}

.fbl4b-btn-danger {
  background: #fff;
  color: #dc2626;
  border: 1px solid #dc2626;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.fbl4b-btn-danger:hover {
  background: #fef2f2;
}

.fbl4b-btn-secondary {
  background: #e4e6eb;
  color: #1c2b33;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.fbl4b-btn-secondary:hover {
  background: #d8dadf;
}

.fbl4b-link {
  color: #1877f2;
}

/* ========================================
   FBL4B Pixel Selection UI
   ======================================== */
.fbl4b-pixel-row-selection {
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
}

.fbl4b-selection-badge {
  background: #fef2f2;
  color: #dc2626;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #fca5a5;
  white-space: nowrap;
}

.fbl4b-pixel-helper-text {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

.fbl4b-pixel-selection {
  padding: 40px;
  text-align: center;
  background: #f5f6f7;
  border-radius: 8px;
  border: 1px solid #dddfe2;
}

.fbl4b-pixel-selection h3 {
  margin: 0 0 8px 0;
  color: #1c2b33;
}

.fbl4b-pixel-selection p {
  margin: 0 0 20px 0;
  color: #65676b;
  font-size: 14px;
}

.fbl4b-pixel-select {
  padding: 10px 36px 10px 14px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #1c2b33;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23374151' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 240px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.fbl4b-pixel-select:hover {
  border-color: #9ca3af;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fbl4b-pixel-select:focus {
  border-color: #1877f2;
  outline: none;
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.fbl4b-pixel-inline-select {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.fbl4b-pixel-inline-select .fbl4b-pixel-select {
  margin-bottom: 0;
}

.fbl4b-pixel-row-selection .fbl4b-pixel-select {
  border-color: #dc2626;
  color: #dc2626;
}

.fbl4b-pixel-row-selection .fbl4b-pixel-select:hover {
  border-color: #b91c1c;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.15);
}

.fbl4b-pixel-row-selection .fbl4b-pixel-select:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.fbl4b-btn-confirm {
  background: #1877f2;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.fbl4b-btn-confirm:hover {
  background: #166fe5;
}

.fbl4b-btn-confirm.fbl4b-btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fbl4b-btn-confirm.fbl4b-btn-disabled:hover {
  background: #1877f2;
}

.fbl4b-pixel-alert {
  padding: 16px;
  background: #fff8e1;
  border: 1px solid #f9a825;
  border-radius: 6px;
}

.fbl4b-pixel-alert-text {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #1c2b33;
  line-height: 1.5;
}

/* ========================================
   FBL4B Loading & Reconnect States
   ======================================== */
.fbl4b-loading-container {
  padding: 40px;
  text-align: center;
  background: #f5f6f7;
  border-radius: 8px;
  border: 1px solid #dddfe2;
}

.fbl4b-loading-text {
  color: #65676b;
  font-size: 16px;
  margin: 0;
}

.fbl4b-iframe-full {
  border: none;
  width: 100%;
  height: 700px;
}

/* ========================================
   FBL4B Upgrade Notice (for MBE users)
   ======================================== */
.fbl4b-upgrade-notice {
  border-left-color: var(--fbl4b-primary-blue) !important;
}

.fbl4b-upgrade-notice-content {
  padding: 8px 0;
}

.fbl4b-upgrade-notice-content p {
  margin: 4px 0;
}

.fbl4b-upgrade-dismiss {
  color: var(--fbl4b-text-secondary);
  text-decoration: none;
  font-size: 13px;
}

.fbl4b-upgrade-dismiss:hover {
  color: var(--fbl4b-text-primary);
  text-decoration: underline;
}
.hide-last-button button:last-of-type{
    display: none;
}

.fb-adv-conf {
    margin-top: 24px;
    padding-top: 15px;
    border-top: 1px solid #ccc;
    display: none;
}

.fb-capi-ef {
    display: none;
}

.fb-adv-conf-title {
    font-size: 1.0625rem;
    padding-bottom: 20px;
    color: rgb(5,5,5);
    font-weight: 600;
}

.fb-capi-title {
    font-size: .9375rem;
    color: rgb(5,5,5);
    font-weight: 600;
}

.fb-capi-se {
    color: #cc0000;
    padding-top:2px;
    padding-left: 10px;
}

.fb-capi-title label {
    padding-right: 5px;
}

.fb-capi-desc  {
    padding-left: 25px;
    color: rgb(5,5,5);
    padding-top: 5px;
    padding-bottom: 5px;
}

.bg-white {
    background-color: white;
}

/* Events Manager Section */
.events-manager-wrapper.hidden {
    display: none;
}

.events-manager-wrapper {
  margin: 0px 20px 20px 0px;
}

.events-manager-container {
    display: flex;
    flex-direction: column;
    gap: 36px;
    padding: 36px 20px;
    background-color: #ffffff;
    position: relative;
}

.events-manager-container h3 {
    font-size: 18px;
    margin-top: 0;
}

.events-manager-container p {
    font-size: 14px;
    max-width: 600px;
}

.events-manager-container label,
.events-manager-container h4 {
    font-size: 16px;
    font-weight: 600;
}

.events-manager-container input,
.events-manager-container select,
.events-manager-container textarea.open {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
    box-shadow: 3px 2px 17px 0px rgba(0, 0, 0, 0.25);
    border: none;
}

.events-manager-container textarea {
    height: 0;
    resize: none;
    margin-bottom: 10px;
    opacity: 0;
    border: none;
    pointer-events: none;
    transition: all 0.5s ease;
}

.events-manager-container textarea.open {
    height: auto;
    opacity: 1;
    pointer-events: initial;
}

.events-manager-container input:disabled {
    background-color: #e2e5e9;
    color: #00000050;
    box-shadow: none;
    cursor: not-allowed;
}

.events-manager-container .meta-event-manager {
    margin-bottom: 0px;
}

.events-manager-block {
    display: flex;
    flex-direction: column;
    padding: 16px;
    border-radius: 6px;
    box-shadow: 3px 2px 17px 0px rgba(0, 0, 0, 0.25);
}

.pixel-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 378px;
}

.pixel-block a,
.test-form button {
    padding: 10px 6px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background-color: #1b74e4;
    border-radius: 6px;
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: 0.3s;
}

.pixel-block a:hover,
.test-form button:hover {
    box-shadow: 3px 2px 17px 0px rgba(0, 0, 0, 0.25);
}

.test-events-block {
    display: flex;
    flex-direction: row;
    width: fit-content;
    gap: 30px;
    background: #fff;
    z-index: 3;
}

.test-form {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.test-hints__wrapper {
    background-color: #bfdcff;
}

.event-hints__wrapper {
    position: relative;
    margin-top: 10px;
    background-color: #e2e5e9;
}

.test-hints__wrapper,
.event-hints__wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
}

.test-hints__wrapper span,
.event-hints__wrapper span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 50%;
    background-color: #000000;
}

.test-hints__wrapper span {
    color: #bfdcff;
}

.event-hints__wrapper span {
    color: #e2e5e9;
}

.event-hints__wrapper .event-hints__close-icon {
    position: absolute;
    right: 12px;
    cursor: pointer;
    font-size: 12px;
}

.event-hints__close-icon.hidden {
    display: none;
}

.test-hints {
    margin-bottom: 10px;
}

.test-hints p,
.event-hints p {
    max-width: 50ch;
    margin: 0;
    color: #000000;
}

.test-form-field-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.text-form-inputs {
    display: flex;
    gap: 10px;
}

.text-form-inputs div {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.text-form-inputs div:first-child {
    width: 320px;
}

.text-form-inputs select {
    width: 218px;
}

.test-event-code-wrapper input::placeholder {
    color: #cccccc;
}

.test-form button {
    width: 100%;
}

.test-form-img {
    position: absolute;
    top: 130px;
    left: 35%;
    width: 600px;
    height: 370px;
    z-index: 2;
}

.advanced-edit-toggle {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: max-content;
}

.advanced-edit-toggle-arrow {
    height: 6px;
    margin-left: 8px;
    margin-top: 3px;
    transform: rotate(-180deg);
    transition: all 0.5s ease;
}

.advanced-edit-toggle-arrow.open {
    transform: rotate(0);
}

.advanced-payload-controls-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
}

#populate-payload-button {
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#populate-payload-button.show {
    opacity: 1;
    pointer-events: initial;
}

.event-log-block {
    width: 50%;
}

.event-log-block h4 {
    margin: 0 0 3px 0px;
}

.event-log-block table {
    display: block;
    max-width: 550px;
}

.event-log-block tbody {
    display: grid;
}

.event-log-block table tr {
    display: grid;
    grid-template-columns: minmax(250px, auto) 150px 95px;
    grid-template-rows: 42px auto;
    gap: 0 10px;
    align-items: center;
    height: 100%;
    min-height: 40px;
    border-bottom: 1px solid #e2e5e9;
}

.event-log-block .event-log-block__head tr {
    border-bottom: 1px solid #717375;
    align-items: self-end;
    text-align: center;
}

.event-log-block .event-log-block__head tr td:first-child {
    text-align: left;
}

.event-log-block .event-log-block__head tr td {
    margin-bottom: 5px;
}

.event-log-block table tbody tr td {
    display: block;
    color: #000000;
    font-size: 14px;
}

.event-log-block table tbody tr td:last-child {
    justify-self: end;
}

.event-log-block__head {
    display: block;
    height: 40px;
}

.test-event-td,
.test-event-pill {
    font-size: 12px;
}

.test-event-pill {
    display: block;
    width: 80px;
    padding: 1px 6px;
    border-radius: 5px;
    font-weight: 700;
    text-align: center;
    background-color: #ececec;
}

.test-event-pill--success {
    color: #007e59;
    background-color: #daf2c2;
}

.test-event-pill--error {
    color: #991700;
    background-color: #f2bab0;
}

.event-log-block table .test-event-msg--error {
    grid-column: 1 / 4;
    display: block;
    min-height: 0;
    width: 97.5%;
    margin-bottom: 10px;
    font-weight: 100;
    text-align: left;
    font-size: 12px;
    background: #ececec;
    overflow: hidden;
    transition: all 0.2s ease-out;
    padding: 7px;
    opacity: 1;
    border-radius: 6px;
    z-index: 2;
}

.event-log-block table .test-event-msg--error.hidden {
    height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
}

.test-event-button--error {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #de3f2466;
    color: #991700;
}

.show-error-icon {
    margin-left: 5px;
    margin-top: 1px;
    width: 10px;
    height: 10px;
    transform: rotate(-180deg);
    transition: all 0.5s ease;
}

.show-error-icon.open {
    transform: rotate(0);
    margin-top: 2px;
}

.show-error-icon path {
    fill: #991700;
}

.event-log-block table tbody tr .test-event-pill--type {
    background-color: #ececec;
    color: #797979;
    min-width: fit-content;
    width: auto;
    font-size: 12px;
}

.test-event-button--error:hover {
    cursor: pointer;
}

@media screen and (max-width: 1360px) {
    .pixel-block {
        width: auto;
    }

    .test-events-block {
        flex-direction: column;
        width: auto;
    }

    .test-form,
    .event-log-block {
        width: 100%;
    }

    .test-form button,
    .test-hints,
    .event-hints {
        max-width: 550px;
    }

    .test-form-img {
        display: none;
    }

    .event-log-block table {
        max-width: auto;
    }
}

/* ========================================
   Responsive
   ======================================== */
@media screen and (max-width: 768px) {
  .fbl4b-connected-container {
    margin: 10px 10px 10px 0;
  }

  .fbl4b-connected-header {
    padding: 16px;
  }

  .fbl4b-connected-title {
    font-size: 15px;
  }

  .fbl4b-connected-logo-text {
    font-size: 16px;
  }

  .fbl4b-connected-details {
    padding: 12px 16px;
  }

  .fbl4b-connected-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .fbl4b-connected-value {
    font-size: 13px;
    word-break: break-all;
  }

  .fbl4b-connected-section,
  .fbl4b-connected-section-last {
    padding: 16px;
  }

  .fbl4b-pixel-inline-select {
    flex-direction: column;
    margin-left: 0;
    width: 100%;
  }

  .fbl4b-pixel-select {
    min-width: unset;
    width: 100%;
  }

  .fbl4b-pixel-row-selection {
    flex-direction: column;
    align-items: flex-start;
  }

  #fbe-iframe {
    margin: 10px 10px 10px 0;
  }

  .events-manager-wrapper {
    margin: 0px 10px 10px 0px;
  }
}
