$dg-primary-color: #e94d18;
$dg-border-color: rgba(#dee2e6, 0.5);
$dg-error-message-color: #dc3545;

// Modal Header
.modal-header {
  background: linear-gradient(195deg, darken($dg-primary-color, 5%), $dg-primary-color);
  color: white;
  padding: 1.5rem 2rem;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .modal-title {
    font-weight: 600;
    letter-spacing: -0.25px;
    font-size: 1.25rem;
  }

  .close {
    background: transparent;
    border: none;
    font-size: 1.75rem;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: opacity 0.2s ease;

    &:hover {
      opacity: 0.8;
    }
  }
}

// Modal Body
.modal-body {
  padding: 1.5rem 2rem;
  background: white;
  max-height: 75vh;
  overflow: hidden;

  form {
    height: 100%;
  }

  .table-container {
    width: 100%;
    height: 100%;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid $dg-border-color;
    border-radius: 0.5rem;
    padding: 0.5rem;

    // Custom scrollbars
    &::-webkit-scrollbar {
      width: 8px;
    }

    &::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 4px;
    }

    &::-webkit-scrollbar-thumb {
      background: lighten($dg-primary-color, 20%);
      border-radius: 4px;

      &:hover {
        background: $dg-primary-color;
      }
    }

    // Table overrides
    ::ng-deep .cmdb-table .table {
      margin-bottom: 0;
      background: white;

      thead th {
        position: sticky;
        top: 0;
        z-index: 10;
        background-color: #f8f9fa;
        border-bottom: 2px solid $dg-border-color;
        font-weight: 600;
        color: #4a4a4a;
        font-size: 0.9rem;
        padding: 1rem 0.75rem;
      }

      tbody td {
        padding: 0.75rem;
        font-size: 0.9rem;
        vertical-align: middle;
        border-bottom: 1px solid rgba($dg-border-color, 0.5);
      }

      tbody tr:hover {
        background-color: rgba($dg-primary-color, 0.05);
      }
    }

    // Pagination (if present)
    ::ng-deep .pagination {
      margin: 1rem 0 0.5rem 0;
      justify-content: center;

      .page-link {
        color: $dg-primary-color;
        border-color: $dg-border-color;

        &:hover {
          background-color: rgba($dg-primary-color, 0.1);
          border-color: $dg-primary-color;
          color: $dg-primary-color;
        }
      }

      .page-item.active .page-link {
        background-color: $dg-primary-color;
        border-color: $dg-primary-color;
      }
    }
  }
}

// Modal Footer
.modal-footer {
  border-top: 1px solid rgba(#dee2e6, 0.3);
  padding: 1.25rem 2rem;
  background: white;
  display: flex;
  justify-content: flex-end;

  .btn {
    font-size: 0.9rem;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
  }
}

// Responsive Tweaks
@media (max-width: 768px) {
  .modal-header,
  .modal-footer {
    padding: 1rem;
  }

  .modal-title {
    font-size: 1.1rem;
  }

  .modal-body {
    max-height: 60vh;
    padding: 1rem;

    .table-container {
      max-height: calc(60vh - 6rem);
    }

    ::ng-deep .cmdb-table .table {
      font-size: 0.8rem;

      thead th,
      tbody td {
        padding: 0.5rem;
      }
    }
  }
}

// Modal Width Control
::ng-deep .modal-dialog {
  max-width: 95vw;
  width: 1200px;
  height: 85vh;
  max-height: 85vh;
  display: flex;
  align-items: center;

  .modal-content {
    height: 70%;
    max-height: 70%;
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 1260px) {
  ::ng-deep .modal-dialog {
    max-width: 98vw;
  }
}
