/* Line Items Table - Desktop */

/* Line Items Table - Clean Modern Look */
.line-items-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  background: none;
  margin-bottom: 1rem;
}
.line-items-table th {
  background: none;
  font-weight: 600;
  font-size: 15px;
  padding: 6px 4px 6px 0;
  border: none;
  color: #333;
}
.line-items-table td {
  background: #f8fafc;
  border: none;
  font-size: 15px;
  padding: 10px 6px 10px 0;
  vertical-align: middle;
}
.line-items-table tr {
  border-radius: 8px;
  box-shadow: none;
}
.line-items-table td:last-child,
.line-items-table th:last-child {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  padding-left: 0;
  padding-right: 0;
}
.line-items-remove {
  z-index: 2;
  position: relative;
  min-width: 32px;
  width: 32px;
  text-align: center;
  display: inline-block;
}

/* Responsive: Card style for line items on mobile */

@media (max-width: 600px) {
  .line-items-table {
    border-spacing: 0;
    width: 100%;
  }
  .line-items-table thead {
    display: none;
  }
  .line-items-table tr {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 14px;
    border: 1px solid #e0e0e0;
    padding: 0;
    width: 100%;
  }
  .line-items-table td {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: none;
    font-size: 15px;
    padding: 8px 12px 2px 12px;
    width: 100%;
    background: none;
    box-sizing: border-box;
  }
  .line-items-table td label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
    margin-bottom: 2px;
    display: block;
  }
  .line-items-table input {
    width: 100%;
    font-size: 15px;
    padding: 7px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    margin-bottom: 2px;
    background: #f8fafc;
    box-sizing: border-box;
  }
  .line-items-table td:last-child {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    padding: 8px 12px 8px 12px;
  }
  .line-items-remove {
    margin-left: 8px;
  }
}
.line-items-remove {
  z-index: 2;
  position: relative;
}
@media (max-width: 768px) {
  .details-wrapper > div {
    flex-direction: column !important;
    display: flex !important;
    width: 100% !important;
    gap: 0 !important;
  }
  .details-grid {
    margin-bottom: 1rem;
  }
  .po-line-items-table {
    margin-top: 0.5rem;
  }
}
@media (max-width: 768px) {
  .po-table .details-row {
    display: none;
  }

  .po-table .details-row.open {
    display: block;
  }

  .po-table .details-row td {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  .po-table .details-row td > .details-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Desktop default: hide details rows until opened */
.po-table .details-row {
  display: none;
}

@media (min-width: 769px) {
  .po-table .details-row.open {
    display: table-row;
  }
}
/* =====================================================
   ADMIN – BASE
   ===================================================== */
.card {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
h3 {
  margin-bottom: 16px;
}

.btn-compact {
  width: auto !important;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
}

.po-table th.sortable {
  cursor: pointer;
}
.po-table th.sortable:hover {
  color: #2563eb;
}
/* =====================================================
   FORM ROW
   ===================================================== */
.form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  gap: 12px;
  margin-bottom: 20px;
}

.form-row input,
.form-row select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 14px;
}

/* =====================================================
   TABLE (DESKTOP)
   ===================================================== */
.po-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
    padding: 12px 14px;

.po-table th {
  text-align: left;
  font-weight: 600;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
}
    flex-wrap: nowrap;
.po-table td {
  padding: 14px 10px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

    min-width: 92px;
    margin-right: 6px;
    flex: 0 0 auto;
  width: 100%;

  .site-table td > * {
    text-align: left;
  }
  overflow-x: auto;
}

/* Narrow Actions column */
.actions-col {
  width: 120px;
}

/* =====================================================
   ACTIONS BUTTON (MATCH ADD USER)
   ===================================================== */
.actions-menu {
  position: relative;
  text-align: right;
}

.actions-trigger {
  background: #b7342b;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.actions-trigger:hover {
  background: #9f2b24;
}

/* =====================================================
   ACTIONS DROPDOWN
   ===================================================== */
.actions-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  padding: 6px 0;
  z-index: 100;
}

.actions-dropdown.hidden {
  display: none;
}

.actions-dropdown button {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

.actions-dropdown button:hover {
  background: #f6f6f6;
}

.actions-dropdown hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid #eee;
}

/* Delete */
.actions-dropdown .btn-danger {
  color: #c0392b;
  font-weight: 600;
}

.actions-dropdown .btn-danger:hover {
  background: rgba(192,57,43,0.12);
}

/* Dashboard header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 1rem 1rem 0 1rem;
}

.dashboard-actions {
  display: flex;
  gap: 0.5rem;
}

/* =====================================================
   RESPONSIVE – TABLET
   ===================================================== */
@media (max-width: 1000px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .actions-col {
    width: 100px;
  }
}

/* =====================================================
   MOBILE – CARD MODE (ADMIN ONLY)
   ===================================================== */
@media (max-width: 768px) {

  /* Dashboard header - stack buttons on mobile */
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .dashboard-actions {
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
  }

  .dashboard-actions .btn {
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 14px;
  }

  /* Hide icons on mobile buttons */
  .dashboard-actions .btn i {
    display: none;
  }

  /* Kill table layout */
  .po-table,
  .po-table thead,
  .po-table tbody,
  .po-table tr,
  .po-table td {
    display: block;
    width: 100%;
  }

  .po-table thead {
    display: none;
  }

  /* Each row becomes a card */
  .po-table tr {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    padding: 14px 16px;
    margin-bottom: 14px;
  }


  .po-table td {
    border: none;
    padding: 6px 0;
  }

  /* Name */
  .po-table td:nth-child(1) {
    font-weight: 600;
    font-size: 15px;
  }

  /* Email */
  .po-table td:nth-child(2) {
    font-size: 13px;
    color: #666;
    word-break: break-word;
  }

  /* Role */
  .po-table td:nth-child(3) select {
    width: 100%;
    margin-top: 6px;
  }

  /* Status */
  .po-table td:nth-child(4) {
    font-size: 13px;
    margin-top: 4px;
  }

  /* Sites table card layout */
  .site-table tr {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    padding: 12px 14px;
    margin-bottom: 12px;
  }

  .site-table td {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 4px;
    padding: 6px 0;
    border: none;
    flex-wrap: wrap;
  }

  .site-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #666;
    margin-right: 0;
    min-width: 0;
  }

  .site-table td.actions-cell {
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    width: 100% !important;
  }

  .site-table td.actions-cell::before {
    display: none;
  }

  .site-table td.actions-cell button {
    width: auto;
    min-width: 96px;
  }

  /* Actions pinned bottom-right */
  .actions-menu {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
  }

  .actions-trigger {
    width: auto;
  }

  .actions-dropdown {
    right: 0;
    left: auto;
  }

  /* Forms stack */
  .form-row {
    grid-template-columns: 1fr;
  }

  .btn-primary {
    width: 100%;
  }

  .btn-compact {
    width: auto !important;
  }
}

/* =====================================================
   MODAL STYLES
   ===================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-content {
  background: white;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 10001;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #333;
}

.modal-content p {
  margin: 0 0 1rem 0;
}

.modal-content .form-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.modal-content .form-row > div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal-content label {
  font-weight: 500;
  color: #333;
  font-size: 0.95rem;
}

.modal-content select,
.modal-content input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.modal-content select:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  opacity: 0.6;
}

.modal-content ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.5rem;
}

.modal-content ul li {
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.modal-content .form-row:last-of-type {
  flex-direction: row;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* =====================================================
   MODALS (USERS)
   ===================================================== */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-content {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  width: 92%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  z-index: 10001;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid input,
.form-grid select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}


@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}
