/* ===== GrubTech Activations Builder - Design System ===== */

/* --- Reset & Base --- */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #525252;
  background-color: #F7F7F7;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: #006CF0; text-decoration: none; }
a:hover { text-decoration: underline; }

h1 {
  font-family: 'Open Sans', sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: #141414;
  margin: 0;
}

h2 {
  font-family: 'Open Sans', sans-serif;
  font-size: 18px;
  color: #006CF0;
  margin: 0;
}

p {
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #525252;
}

/* --- Layout --- */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

.card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 30px 40px;
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #006CF0;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}

.back-btn:hover { opacity: 0.8; }

.back-btn img {
  width: 20px;
  height: 20px;
}

.company-info h1 {
  margin-bottom: 2px;
}

.company-info .subtitle {
  font-size: 13px;
  color: #737373;
}

.logo-container {
  text-align: center;
  margin-bottom: 30px;
}

.logo-container img {
  width: 180px;
}

/* --- Buttons --- */
.primary_button {
  background: #006CF0;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.primary_button:hover {
  background: #fff;
  color: #006CF0;
  box-shadow: inset 0 0 0 1px #006CF0;
}

.primary_button_invalid,
.primary_button:disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.7;
}

.secondary_button {
  background: #fff;
  color: #424242;
  border: 1px solid #D6D6D6;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.secondary_button:hover {
  background: #F7F7F7;
}

.link-button {
  background: none;
  border: none;
  color: #006CF0;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  font-family: 'Open Sans', sans-serif;
}

.link-button:hover { text-decoration: underline; }

.remove-btn {
  background: none;
  border: none;
  color: #dc0320;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.remove-btn:hover { opacity: 0.7; }

/* --- Inputs --- */
input[type="text"],
input[type="date"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid #D6D6D6;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  color: #141414;
  background: #fff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: #006CF0;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #525252;
  margin-bottom: 6px;
}

.input-group label .req {
  color: #dc0320;
}

/* Table inline inputs */
.table-input {
  border: none;
  background: #efeded;
  padding: 5px 8px;
  border-radius: 2px;
  font-size: 13px;
  width: 120px;
}

/* --- Search Bar --- */
.search-container {
  position: relative;
  margin-bottom: 16px;
  max-width: 400px;
}

.search-container img {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  opacity: 0.5;
}

.search-container input {
  padding-left: 38px;
}

/* --- Tables --- */
.table-wrapper {
  background: #fff;
  border: 1px solid #E5E5E5;
  border-radius: 5px;
  overflow: hidden;
}

.deployment-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.deployment-table thead {
  background: #FAFAFA;
}

.deployment-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: #737373;
  text-transform: uppercase;
  text-align: left;
  padding: 14px 16px;
  height: 52px;
  border-bottom: 1px solid #E5E5E5;
  white-space: nowrap;
}

.deployment-table thead th:first-child {
  width: 50px;
  text-align: center;
}

.deployment-table tbody {
  display: block;
  max-height: 500px;
  overflow-y: auto;
}

.deployment-table thead,
.deployment-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.deployment-table tbody tr {
  border-bottom: 1px solid #F0F0F0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.deployment-table tbody tr:hover {
  background: #FAFAFA;
}

.deployment-table tbody td {
  padding: 12px 16px;
  font-size: 14px;
  color: #141414;
  vertical-align: middle;
}

.deployment-table tbody td:first-child {
  width: 50px;
  text-align: center;
}

/* Checkbox column widths */
.col-check { width: 50px; }
.col-deployment { width: 22%; }
.col-brand { width: 18%; }
.col-location { width: 16%; }
.col-channels { width: 26%; }
.col-status { width: 14%; }

/* --- Activation Sub-rows --- */
.activation-row {
  background: #FAFAFA;
  display: none;
}

.activation-row.visible {
  display: table-row;
}

.activation-row td {
  padding: 8px 16px 8px 66px;
  font-size: 13px;
  color: #525252;
}

.activation-row .activation-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.activation-row .activation-cell .channel-label {
  font-weight: 500;
  min-width: 120px;
}

/* --- Badges / Pills --- */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 11px;
  color: #fff;
  white-space: nowrap;
}

.badge-green { background: #079455; }
.badge-orange { background: #DC6803; }
.badge-red { background: #dc0320; }

.channel-pill {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 11px;
  border: 1px solid #D6D6D6;
  color: #424242;
  white-space: nowrap;
  margin: 2px 2px;
}

.channel-pill.more {
  background: #F0F0F0;
  border-color: #E5E7EB;
  color: #737373;
}

/* --- Caret / Accordion --- */
.caret-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.25s ease;
  transform: rotate(-90deg);
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.caret-icon.expanded {
  transform: rotate(0deg);
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 30px 16px;
  border-bottom: 1px solid #F0F0F0;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 18px;
  color: #141414;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.modal-close img {
  width: 24px;
  height: 24px;
}

.modal-close:hover { opacity: 0.6; }

.modal-body {
  padding: 20px 30px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 30px 24px;
  border-top: 1px solid #F0F0F0;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- Channel List (in modal) --- */
.channel-list {
  max-height: 350px;
  overflow-y: auto;
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  margin-top: 10px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #F5F5F5;
  cursor: pointer;
  transition: background 0.15s ease;
}

.channel-item:last-child { border-bottom: none; }
.channel-item:hover { background: #F7F7F7; }

.channel-item.selected {
  background: #D1E0FF;
}

.channel-item label {
  font-size: 14px;
  color: #141414;
  cursor: pointer;
  flex: 1;
}

/* --- Form Sections --- */
.form-section {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  background: #FAFAFA;
}

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #141414;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #E5E7EB;
}

/* --- Deployment Entry (Add Location) --- */
.deployment-entry {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: #FAFAFA;
  position: relative;
}

.deployment-entry .remove-entry {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* --- Legal / Terms --- */
.legal-text {
  background: #F7F7F7;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 16px;
  font-size: 13px;
  color: #525252;
  line-height: 1.7;
  margin: 16px 0;
}

.legal-text ul {
  padding-left: 20px;
  margin: 8px 0;
}

.legal-text ul li {
  margin-bottom: 4px;
}

.legal-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
}

.legal-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #006CF0;
}

.legal-checkbox label {
  font-size: 13px;
  color: #525252;
  cursor: pointer;
}

/* --- Selection Bar --- */
.selection-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #D1E0FF;
  padding: 14px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}

.selection-bar.visible {
  opacity: 1;
  pointer-events: auto;
}

.selection-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.selection-bar-left input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #006CF0;
}

.selection-bar-left span {
  font-size: 14px;
  font-weight: 500;
  color: #141414;
}

.selection-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Real-time Save States --- */
.saving {
  opacity: 0.6;
  pointer-events: none;
}

.saved {
  box-shadow: 0 0 0 3px #22c55e33;
}

.error {
  box-shadow: 0 0 0 3px #ef444433;
}

/* --- Spinner --- */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.8);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.spinner-overlay.active {
  display: flex;
}

.spinner-overlay img {
  width: 60px;
  height: 60px;
}

/* --- Home Page --- */
.home-card {
  max-width: 500px;
  margin: 80px auto;
  text-align: center;
  padding: 50px 40px;
}

.home-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.home-card .subtitle {
  color: #737373;
  margin-bottom: 40px;
}

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  color: #141414;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.menu-link:hover {
  border-color: #006CF0;
  background: #F0F7FF;
  text-decoration: none;
  color: #006CF0;
}

.menu-link .arrow {
  font-size: 18px;
  color: #006CF0;
}

/* --- Deactivation Type Select --- */
.deactivation-select {
  margin-bottom: 20px;
}

.deactivation-select select {
  max-width: 350px;
}

/* --- Instruction Text --- */
.instruction-text {
  background: #F0F7FF;
  border: 1px solid #B3D4FF;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #006CF0;
  margin-bottom: 16px;
}

/* --- Swap Dialog --- */
.swap-section {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  background: #FAFAFA;
}

.swap-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: #141414;
  margin-bottom: 12px;
}

.swap-activation-entry {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
  align-items: end;
}

.swap-activation-entry .input-group {
  margin-bottom: 0;
}

/* --- Confirmation Modal --- */
.confirmation-content {
  text-align: center;
  padding: 30px 20px;
}

.confirmation-content h2 {
  color: #079455;
  font-size: 20px;
  margin-bottom: 12px;
}

.confirmation-content p {
  color: #525252;
}

/* --- Checkbox Styling --- */
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #006CF0;
  cursor: pointer;
}

/* --- Utility --- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .page-container { padding: 16px; }
  .card { padding: 20px; }
  .header { flex-direction: column; align-items: flex-start; }
  .modal { max-width: 95vw; margin: 10px; }
  .deployment-table tbody { max-height: 400px; }
  .swap-activation-entry { grid-template-columns: 1fr; }
  .home-card { margin: 30px auto; padding: 30px 20px; }
}

/* --- Selected Row --- */
.deployment-table tbody tr.selected {
  background: #EBF2FF;
}

/* --- Deactivation channel checkboxes in activation rows --- */
.activation-row .activation-checkbox {
  margin-right: 8px;
}

/* --- Count badge in selection bar --- */
.count-badge {
  background: #006CF0;
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
