/**
 * Dashboard/All Popups List Page Styles
 *
 * Styles for the main popup list/dashboard page
 * Loaded on: instant-popup-builder page (main list)
 */

/* Modern UI refresh for All Popups dashboard (non-breaking, scoped) */
.instant_popup_wrapper {
  --ipb-bg: #ffffff;
  --ipb-surface: #ffffff;
  --ipb-border: #e5e7eb;
  --ipb-muted: #6b7280;
  --ipb-text: #111827;
  --ipb-primary: #1a73e8;
  --ipb-danger: #d32f2f;
  --ipb-success: #03e334;
  --ipb-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 8px 24px rgba(17,24,39,0.06);
}

/* Header spacing alignment */
.instant_popup_wrapper .top_heading,
.instant_popup_wrapper .ipb_top_bar {
  background: var(--ipb-surface);
}

/* Filters row */
.instant_popup_wrapper .filter_wrapper {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  margin-top: 50px;
  justify-content: start;
}

.instant_popup_wrapper .popup_bulk_filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.instant_popup_wrapper .instant_filter { width: auto; float: none; flex: 0 0 auto; }
.instant_popup_wrapper .search_wrapper { float: none; width: auto; }
.instant_popup_wrapper .search_wrapper form { display: inline-flex; }
.instant_popup_wrapper .instant_filter .search_wrapper input#search_popup { width: 26ch; flex: 0 0 26ch; }

/* Right-side actions (Add New) */
.instant_popup_wrapper .ipb_actions_right { display: flex; justify-content: flex-end; padding-right: 52px; }
.instant_popup_wrapper .ipb_actions_right #popup_btn {
  margin: 0 !important;
  background: var(--ipb-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  line-height: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.instant_popup_wrapper .popup_bulk_filter select#bulk_val {
  appearance: none;
  background: var(--ipb-bg);
  border: 1px solid var(--ipb-border) !important;
  color: var(--ipb-text);
  padding: 6px 12px;
  border-radius: 8px;
  min-width: 140px;
}

.instant_popup_wrapper .popup_bulk_filter .button_sbnt a#popup_btn {
  background: var(--ipb-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  line-height: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Search */
.instant_popup_wrapper .instant_filter .search_wrapper input#search_popup {
  background: var(--ipb-bg);
  border: 1px solid var(--ipb-border) !important;
  color: var(--ipb-text);
  padding: 6px 10px;
  border-radius: 8px;
  width: 26ch;
  flex: 0 0 26ch;
  max-width: 100%;
}

/* Table wrapper and table */
.instant_popup_wrapper .popup_lists { margin-top: 8px; }

/* Support existing markup where table is a direct child of wrapper */
.instant_popup_wrapper > table,
.instant_popup_wrapper .popup_lists table {
  width: 98%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--ipb-surface);
  border: 1px solid var(--ipb-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--ipb-shadow);
}

.instant_popup_wrapper > table thead th,
.instant_popup_wrapper .popup_lists table thead th {
  background: #f9fafb;
  color: var(--ipb-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ipb-border) !important;
}

.instant_popup_wrapper > table tbody td,
.instant_popup_wrapper .popup_lists table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ipb-border) !important;
  color: var(--ipb-text);
  font-size: 14px;
}

/* Tighten spacing between bulk checkbox and ID columns */
.instant_popup_wrapper .popup_lists table th:first-child,
.instant_popup_wrapper .popup_lists table td:first-child {
  width: 28px;
  padding-left: 8px;
  padding-right: 4px;
  text-align: center;
}

.instant_popup_wrapper .popup_lists table th:nth-child(2),
.instant_popup_wrapper .popup_lists table td:nth-child(2) {
  width: 56px;
  padding-left: 4px;
  padding-right: 6px; /* keep ID close to Title */
  text-align: left;
}

.instant_popup_wrapper .popup_lists table th:nth-child(3),
.instant_popup_wrapper .popup_lists table td:nth-child(3) {
  padding-left: 6px; /* keep Title close to ID */
}

.instant_popup_wrapper .popup_lists input[type="checkbox"] {
  margin: 0;
}

.instant_popup_wrapper > table tbody tr:hover,
.instant_popup_wrapper .popup_lists table tbody tr:hover {
  background: #f9fbff;
}

.instant_popup_wrapper > table tbody tr:last-child td,
.instant_popup_wrapper .popup_lists table tbody tr:last-child td {
  border-bottom: none !important;
}

/* Title cell actions */
.instant_popup_wrapper .actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.instant_popup_wrapper .actions a {
  background: transparent !important;
  color: var(--ipb-primary) !important;
  padding: 0 !important;
  font-weight: 500;
}

.instant_popup_wrapper .actions a.del_btn {
  color: var(--ipb-danger) !important;
}

/* Icon buttons for actions */
.instant_popup_wrapper .actions .ipb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.instant_popup_wrapper .actions .ipb-icon i { font-size: 14px; }

.instant_popup_wrapper .actions .ipb-icon:hover {
  background: #f1f5f9;
  border-color: var(--ipb-border);
}

.instant_popup_wrapper .actions .del_btn.ipb-icon:hover {
  background: rgba(211,47,47,0.08);
  border-color: rgba(211,47,47,0.25);
}

/* Type badge */
.instant_popup_wrapper .popup_lists p.popu_views {
  display: inline-block;
  background: #f1f5f9;
  color: #0f172a;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  margin: 0;
}

/* Toggle Switch Styles for Dashboard - matching design-tab.css */
.instant_popup_wrapper .popup_active {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.instant_popup_wrapper .popup_active .ipb_tog {
  position: relative;
  display: inline-block;
  width: 38px !important;
  height: 22px;
  padding: 1px 5px !important;
  margin: 0;
  overflow: hidden;
  box-sizing: border-box;
}

/* Hide the default checkbox */
.instant_popup_wrapper .popup_active .ipb_tog input[type="checkbox"] {
  z-index: 9999;
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

/* The slider */
.instant_popup_wrapper .popup_active .ipb_tog .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 50px;
  overflow: hidden;
}

/* The circle inside the slider */
.instant_popup_wrapper .popup_active .ipb_tog .slider:before {
  position: absolute;
  content: "";
  height: 15px;
  width: 15px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

/* Rounded slider */
.instant_popup_wrapper .popup_active .ipb_tog .slider.round {
  border-radius: 50px;
}

.instant_popup_wrapper .popup_active .ipb_tog .slider.round:before {
  border-radius: 50%;
}

/* Checked state */
.instant_popup_wrapper .popup_active .ipb_tog input:checked + .slider {
  background-color: #03E334;
}

/* Move the slider when checked - matching Actions & Events toggle */
.instant_popup_wrapper .popup_active .ipb_tog input:checked + .slider:before {
  transform: translateX(16px);
}

.instant_popup_wrapper .popup_active label {
  color: #1A73E8;
  font-weight: 500;
  font-size: 14px;
  margin: 0;
}

/* Toggle disabled when required extension is missing */
.instant_popup_wrapper .popup_active.ipb-toggle-extension-missing .ipb_tog input[type="checkbox"] {
  cursor: not-allowed;
}
.instant_popup_wrapper .popup_active.ipb-toggle-extension-missing .ipb_tog .slider {
  cursor: not-allowed;
  background-color: #ddd;
  opacity: 0.8;
}
.instant_popup_wrapper .popup_active.ipb-toggle-extension-missing label {
  color: #999;
}

/* Pagination */
.instant_popup_wrapper .pagination {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 8px 0 8px;
}

/* Bulk actions styling */
.instant_popup_wrapper .bulk_actions { display: inline-flex; gap: 8px; align-items: center; margin-top: 0; }
.instant_popup_wrapper .ipb_top_actions { display: flex; justify-content: space-between; align-items: center; margin: 4px 0; }
.instant_popup_wrapper .ipb_top_actions #popup_btn { margin: 0 !important; }

.instant_popup_wrapper .bulk_actions select#ipb_bulk_action {
  appearance: none;
  background: var(--ipb-bg);
  border: 1px solid var(--ipb-border);
  color: var(--ipb-text);
  padding: 6px 10px;
  border-radius: 8px;
}

.instant_popup_wrapper .bulk_actions #popup_bulk_search_ {
  background: var(--ipb-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  line-height: 20px;
  cursor: pointer;
}

.instant_popup_wrapper .pagination .page-numbers {
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 8px;
  padding: 6px 10px;
}

.instant_popup_wrapper .pagination .page-numbers.current {
  background: var(--ipb-primary);
  color: #fff;
}

/* Loader alignment within list placeholder */
.instant_popup_wrapper .popup_lists img {
  display: block;
  margin: 18px auto;
  opacity: .7;
}

/* Legacy dashboard styles */
.popup_status ul {
    align-items: center;
    margin: 0;
    display: flex;
    gap: 20px;
}

.popup_status {
    flex: 0 0 80%;
}

.instant_filter {
    flex: 0 0 20%;
}

span.req {
    color: red !important;
}

.popup_status li a.active {
    color: black;
    font-weight: bold;
    text-decoration: none;
}

.search_wrapper form {
    align-items: center;
    display: flex;
    gap: 10px;
    overflow: hidden;
}

input#key_search {
    border: 1px solid #E0E0E0;
    background: white;
    color: black !important;
}

input#search_popup {
    border: 1px solid #E0E0E0 !important;
}

.popup_lists table {
    background: white;
    width: 98%;
    margin: 20px 0;
}

.popup_lists th,
.popup_lists td {
    text-align: left;
    border: none !important;
    border-width: 0px 1px 1px 0px !important;
    border-bottom: 1px solid #E0E0E0 !important;
    border: 1px solid lightgray;
    padding: 15px;
    font-size: 16px;
}

a#popup_btn {
    box-sizing: border-box;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    text-shadow: none;
    margin: 20px 0 !important;
    border: 1px solid #2271b1;
    border-radius: 3px;
    background: #f6f7f7;
    font-size: 16px;
    font-weight: 400;
    line-height: 2.15384615;
    color: #2271b1;
    padding: 5px 10px;
    min-height: 30px;
    -webkit-appearance: none;
}

.instant_popup_wrapper .pagination,
.ipb_subscriptiobn_wrapper .pagination {
    justify-content: end;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px 20px 20px;
}

.instant_popup_wrapper .pagination a.page-numbers,
.ipb_subscriptiobn_wrapper .pagination a.page-numbers {
    text-decoration: none;
    font-size: 14px;
    border-radius: 5px;
    background: #1A73E8;
    padding: 4px 14px;
    color: white;
    line-height: 26px;
}

.instant_popup_wrapper span.page-numbers.current,
.ipb_subscriptiobn_wrapper .pagination span.page-numbers {
    color: white;
    padding: 4px 14px;
    background: black;
    border-radius: 5px;
    font-size: 14px;
    line-height: 26px;
}

.instant_popup_wrapper .pagination a.page-numbers:hover,
.ipb_subscriptiobn_wrapper .pagination a.page-numbers:hover {
    background: transparent;
    color: #1A73E8;
    border: 1px solid #1A73E8;
}

/* Responsive tweaks */
@media (max-width: 782px) {
  .instant_popup_wrapper .filter_wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  .instant_popup_wrapper .popup_bulk_filter,
  .instant_popup_wrapper .instant_filter {
    width: 100%;
  }
  .instant_popup_wrapper .instant_filter .search_wrapper input#search_popup { width: 100%; }
  .instant_popup_wrapper > table,
  .instant_popup_wrapper .popup_lists table {
    width: 100%;
  }
}
